sys: add the possibility to fuzz what sys_now() returns

This commit is contained in:
Simon Goldschmidt
2020-02-17 21:39:46 +01:00
parent 9b5a6fe1dc
commit fc85b055d7
3 changed files with 16 additions and 2 deletions

View File

@@ -670,9 +670,14 @@ 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);
now = (u32_t)(ts.tv_sec * 1000L + ts.tv_nsec / 1000000L);
#ifdef LWIP_FUZZ_SYS_NOW
now += sys_now_offset;
#endif
return now;
}
u32_t