lwip - Prevent rollover during time calculation.
Use a 64-bit integer to prevent rollover of the intermediate result.
@@ -101,13 +101,10 @@ sys_mutex_unlock(sys_mutex_t *mutex)
static inline uint32_t
sys_now(void)
{
- uint32_t t;
+ uint64_t t;
- /*
- * XXX not right when g_os_time rolls over
- */
- t = os_time_get() * 1000 / OS_TICKS_PER_SEC;
- return t;
+ t = os_time_get();
+ return t * 1000 / OS_TICKS_PER_SEC;
}
static inline err_t
