Fixed os_gettime_ns to provide correct time in ns
parent
3f0b352d7f
commit
1deb27d502
|
@ -77,9 +77,9 @@ void os_sleep_ms(uint32_t duration)
|
||||||
|
|
||||||
uint64_t os_gettime_ns(void)
|
uint64_t os_gettime_ns(void)
|
||||||
{
|
{
|
||||||
struct timespec tp;
|
struct timespec ts;
|
||||||
clock_gettime(CLOCK_REALTIME, &tp);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
return tp.tv_nsec;
|
return ((uint64_t) ts.tv_sec * 1000000000ULL + (uint64_t) ts.tv_nsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* should return $HOME/.[name] */
|
/* should return $HOME/.[name] */
|
||||||
|
|
Loading…
Reference in New Issue