amiro-os / kernel / patches / chTimeAddX-overflow-fix.patch @ e5742249
History | View | Annotate | Download (672 Bytes)
1 | 1dd7edc7 | Thomas Schöpping | diff --git a/os/rt/include/chtime.h b/os/rt/include/chtime.h
|
---|---|---|---|
2 | --- a/os/rt/include/chtime.h
|
||
3 | +++ b/os/rt/include/chtime.h
|
||
4 | 732a4657 | Thomas Schöpping | @@ -441,11 +441,11 @@ static inline time_usecs_t chTimeI2US(sysinterval_t interval) { |
5 | 1dd7edc7 | Thomas Schöpping | static inline systime_t chTimeAddX(systime_t systime, |
6 | sysinterval_t interval) { |
||
7 | |||
8 | -#if CH_CFG_ST_RESOLUTION != CH_CFG_INTERVALS_SIZE
|
||
9 | 57a5d1df | Thomas Schöpping | - chDbgCheck(interval <= (sysinterval_t)TIME_MAX_SYSTIME);
|
10 | 1dd7edc7 | Thomas Schöpping | +#if CH_CFG_ST_RESOLUTION < CH_CFG_INTERVALS_SIZE
|
11 | + return systime + (systime_t)(interval % ((sysinterval_t)1 << CH_CFG_ST_RESOLUTION));
|
||
12 | +#else
|
||
13 | + return systime + interval;
|
||
14 | #endif
|
||
15 | -
|
||
16 | - return systime + (systime_t)interval;
|
||
17 | } |
||
18 | |||
19 | /** |