Skip to content

Commit cd5bfa1

Browse files
brad0jbkempf
authored andcommitted
riscv: Fix building on non-Linux OS's
CLOCK_MONOTONIC_RAW is not POSIX/portable.
1 parent 5ea4939 commit cd5bfa1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/checkasm/checkasm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,11 @@ static inline uint64_t readtime(void) {
208208
#include <time.h>
209209
static inline uint64_t clock_gettime_nsec(void) {
210210
struct timespec ts;
211+
#ifdef CLOCK_MONOTONIC_RAW
211212
clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
213+
#else
214+
clock_gettime(CLOCK_MONOTONIC, &ts);
215+
#endif
212216
return ((uint64_t)ts.tv_sec*1000000000u) + (uint64_t)ts.tv_nsec;
213217
}
214218
#define readtime clock_gettime_nsec

0 commit comments

Comments
 (0)