From 7982ed9a7dab214fa4a13cf7279d269ec951f416 Mon Sep 17 00:00:00 2001 From: raldone01 Date: Tue, 16 Jul 2019 17:52:04 +0200 Subject: [PATCH] newlib: Move _gettimeofday_r call in clock_gettime Signed-off-by: KonstantinKondrashov Merges: https://github.com/espressif/esp-idf/pull/3789 --- components/newlib/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/newlib/time.c b/components/newlib/time.c index 2eb8b4b27..7fb60e94a 100644 --- a/components/newlib/time.c +++ b/components/newlib/time.c @@ -414,10 +414,10 @@ int clock_gettime (clockid_t clock_id, struct timespec *tp) return -1; } struct timeval tv; - _gettimeofday_r(NULL, &tv, NULL); uint64_t monotonic_time_us = 0; switch (clock_id) { case CLOCK_REALTIME: + _gettimeofday_r(NULL, &tv, NULL); tp->tv_sec = tv.tv_sec; tp->tv_nsec = tv.tv_usec * 1000L; break;