newlib: Move _gettimeofday_r call in clock_gettime

Signed-off-by: KonstantinKondrashov <konstantin@espressif.com>
Merges: https://github.com/espressif/esp-idf/pull/3789
This commit is contained in:
raldone01 2019-07-16 17:52:04 +02:00 committed by KonstantinKondrashov
parent eab3edf3d4
commit 7982ed9a7d

View file

@ -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;