Skip to content
Snippets Groups Projects
Commit cd5bfa12 authored by Brad Smith's avatar Brad Smith Committed by Jean-Baptiste Kempf
Browse files

riscv: Fix building on non-Linux OS's

CLOCK_MONOTONIC_RAW is not POSIX/portable.
parent 5ea4939a
No related branches found
No related tags found
1 merge request!1777riscv: Fix building on non-Linux OS's
Pipeline #549810 passed with stages
in 34 minutes and 58 seconds
......@@ -208,7 +208,11 @@ static inline uint64_t readtime(void) {
#include <time.h>
static inline uint64_t clock_gettime_nsec(void) {
struct timespec ts;
#ifdef CLOCK_MONOTONIC_RAW
clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
#else
clock_gettime(CLOCK_MONOTONIC, &ts);
#endif
return ((uint64_t)ts.tv_sec*1000000000u) + (uint64_t)ts.tv_nsec;
}
#define readtime clock_gettime_nsec
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment