Fixed os_gettime_ns to provide correct time in ns

master
Zachary Lund 2014-01-11 15:08:04 -06:00
parent 3f0b352d7f
commit 1deb27d502
1 changed files with 3 additions and 3 deletions

View File

@ -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] */