diff --git a/ports/unix/port/sys_arch.c b/ports/unix/port/sys_arch.c index 3404e8d..fa5bd3c 100644 --- a/ports/unix/port/sys_arch.c +++ b/ports/unix/port/sys_arch.c @@ -606,13 +606,27 @@ sys_mutex_free(struct sys_mutex **mutex) /*-----------------------------------------------------------------------------------*/ /* Time */ + +#if defined FUZZED_TMR +extern u32_t total_external_delay; +#endif + u32_t sys_now(void) { struct timespec ts; + u32_t now; get_monotonic_time(&ts); - return (u32_t)(ts.tv_sec * 1000L + ts.tv_nsec / 1000000L); +#if defined FUZZED_TMR + now = ((u32_t)(ts.tv_sec * 1000L + ts.tv_nsec / 1000000L) + total_external_delay); + LWIP_DEBUGF(SYS_DEBUG, ("sys_now: total_external_delay = %u\n", total_external_delay)); + LWIP_DEBUGF(SYS_DEBUG, ("sys_now: now = %u\n", now)); + return now; +#else + now = (u32_t)(ts.tv_sec * 1000L + ts.tv_nsec / 1000000L); + return now; +#endif } u32_t