diff --git a/os/nil/include/nil.h b/os/nil/include/nil.h index 161c79a6d..6c3084153 100644 --- a/os/nil/include/nil.h +++ b/os/nil/include/nil.h @@ -735,7 +735,7 @@ typedef struct { * @xclass */ #define chVTTimeElapsedSinceX(start) \ - ((systime_t)(chVTGetSystemTimeX() - start)) + ((systime_t)(chVTGetSystemTimeX() - (start))) /** * @brief Checks if the specified time is within the specified time window. @@ -752,7 +752,7 @@ typedef struct { * @xclass */ #define chVTIsTimeWithinX(time, start, end) \ - ((bool)((time) - (start) < (end) - (start))) + ((bool)((systime_t)((time) - (start)) < (systime_t)((end) - (start)))) /** * @brief Condition assertion. diff --git a/os/nil/src/nil.c b/os/nil/src/nil.c index 789256127..d7afe3b87 100644 --- a/os/nil/src/nil.c +++ b/os/nil/src/nil.c @@ -197,7 +197,7 @@ void chSysTimerHandlerI(void) { chSchReadyI(tp, MSG_TIMEOUT); } else { - if (tp->timeout <= next - 1) + if (tp->timeout <= (systime_t)(next - 1)) next = tp->timeout; } }