mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
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:
committed by
KonstantinKondrashov
parent
a6fb161309
commit
02068cf328
@ -415,10 +415,10 @@ int clock_gettime (clockid_t clock_id, struct timespec *tp)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
_gettimeofday_r(NULL, &tv, NULL);
|
|
||||||
uint64_t monotonic_time_us = 0;
|
uint64_t monotonic_time_us = 0;
|
||||||
switch (clock_id) {
|
switch (clock_id) {
|
||||||
case CLOCK_REALTIME:
|
case CLOCK_REALTIME:
|
||||||
|
_gettimeofday_r(NULL, &tv, NULL);
|
||||||
tp->tv_sec = tv.tv_sec;
|
tp->tv_sec = tv.tv_sec;
|
||||||
tp->tv_nsec = tv.tv_usec * 1000L;
|
tp->tv_nsec = tv.tv_usec * 1000L;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user