patch by Chrysn: patch #8704 fix sys_timeouts_sleeptime function

This commit is contained in:
sg 2015-08-18 21:38:08 +02:00
parent 21815a1427
commit c2f978bd1e
2 changed files with 10 additions and 1 deletions

View File

@ -249,6 +249,9 @@ HISTORY
++ Bugfixes:
2015-08-18: Chrysn
timers.c: patch #8704 fix sys_timeouts_sleeptime function
2015-07-01: Erik Ekman
* puf.c: fixed bug #45454 (pbuf_take_at() skips write and returns OK if offset
is at start of pbuf in chain)

View File

@ -495,10 +495,16 @@ sys_restart_timeouts(void)
u32_t
sys_timeouts_sleeptime(void)
{
u32_t diff;
if (next_timeout == NULL) {
return 0xffffffff;
}
return (sys_now() - timeouts_last_time) + next_timeout->time;
diff = sys_now() - timeouts_last_time;
if (diff > next_timeout->time) {
return 0;
} else {
return next_timeout->time - diff;
}
}
#else /* NO_SYS */