diff --git a/src/core/timers.c b/src/core/timers.c index 23f8296b..94e8029a 100644 --- a/src/core/timers.c +++ b/src/core/timers.c @@ -326,7 +326,9 @@ sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg) #endif /* LWIP_DEBUG_TIMERNAMES */ { struct sys_timeo *timeout, *t; +#if NO_SYS u32_t now, diff; +#endif timeout = (struct sys_timeo *)memp_malloc(MEMP_SYS_TIMEOUT); if (timeout == NULL) { @@ -334,6 +336,7 @@ sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg) return; } +#if NO_SYS now = sys_now(); if (next_timeout == NULL) { diff = 0; @@ -341,11 +344,16 @@ sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg) } else { diff = now - timeouts_last_time; } +#endif timeout->next = NULL; timeout->h = handler; timeout->arg = arg; +#if NO_SYS timeout->time = msecs + diff; +#else + timeout->time = msecs; +#endif #if LWIP_DEBUG_TIMERNAMES timeout->handler_name = handler_name; LWIP_DEBUGF(TIMERS_DEBUG, ("sys_timeout: %p msecs=%"U32_F" handler=%s arg=%p\n",