From 05c9b4ccb24b71a3638458cfdbfe74f661046395 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Thu, 30 May 2019 08:42:24 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12820 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/rt/include/chtime.h | 2 +- os/rt/include/chvt.h | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/os/rt/include/chtime.h b/os/rt/include/chtime.h index 50aab33fd..608abe70e 100644 --- a/os/rt/include/chtime.h +++ b/os/rt/include/chtime.h @@ -441,7 +441,7 @@ static inline systime_t chTimeAddX(systime_t systime, sysinterval_t interval) { #if CH_CFG_ST_RESOLUTION != CH_CFG_INTERVALS_SIZE - chDbgCheck(interval <= (sysinterval_t)((systime_t)-1)); + chDbgCheck(interval <= (sysinterval_t)TIME_MAX_SYSTIME); #endif return systime + (systime_t)interval; diff --git a/os/rt/include/chvt.h b/os/rt/include/chvt.h index e8a877957..ca3b8bf44 100644 --- a/os/rt/include/chvt.h +++ b/os/rt/include/chvt.h @@ -218,10 +218,8 @@ static inline bool chVTGetTimersStateI(sysinterval_t *timep) { #if CH_CFG_ST_TIMEDELTA == 0 *timep = ch.vtlist.next->delta; #else - *timep = chTimeDiffX(chVTGetSystemTimeX(), - chTimeAddX(ch.vtlist.lasttime, - ch.vtlist.next->delta + - (sysinterval_t)CH_CFG_ST_TIMEDELTA)); + *timep = (ch.vtlist.next->delta + (sysinterval_t)CH_CFG_ST_TIMEDELTA) - + chTimeDiffX(ch.vtlist.lasttime, chVTGetSystemTimeX()); #endif }