Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ar_osal/src/linux/ar_osal_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ uint64_t ar_timer_get_time_in_us(void)
uint64_t us = 0;
struct timespec ts;

#ifdef __ZEPHYR__
if (!clock_gettime(CLOCK_MONOTONIC, &ts))
us = ((ts.tv_sec * 1000000LL) + (ts.tv_nsec / 1000LL));
#else
if (!clock_gettime(CLOCK_BOOTTIME, &ts))
us = ((ts.tv_sec * 1000000LL) + (ts.tv_nsec / 1000LL));
#endif /* __ZEPHYR__ */

return us;
}
Expand All @@ -42,8 +47,13 @@ uint64_t ar_timer_get_time_in_ms(void)
uint64_t ms = 0;
struct timespec ts;

#ifdef __ZEPHYR__
if(!clock_gettime(CLOCK_MONOTONIC, &ts))
ms = ((ts.tv_sec * 1000LL) + (ts.tv_nsec / 1000000LL));
#else
if(!clock_gettime(CLOCK_BOOTTIME, &ts))
ms = ((ts.tv_sec * 1000LL) + (ts.tv_nsec / 1000000LL));
#endif /* __ZEPHYR__ */

return ms;
}
Loading