Skip to content

Commit

Permalink
tmr: fix FreeBSD and OpenBSD (#97)
Browse files Browse the repository at this point in the history
* tmr: fix FreeBSD CLOCK_MONOTONIC
* fix gettimeofday
  • Loading branch information
sreimers authored Apr 20, 2021
1 parent d7101cd commit a6849dd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tmr/tmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Copyright (C) 2010 Creytiv.com
*/
#ifdef DARWIN
#if defined(FREEBSD) || defined(OPENBSD) || defined(DARWIN)
#define _DEFAULT_SOURCE 1
#else
#define _POSIX_C_SOURCE 199309L
Expand Down Expand Up @@ -142,7 +142,11 @@ uint64_t tmr_jiffies_usec(void)
#else
struct timespec now;

#if defined(FREEBSD) || defined(OPENBSD)
if (0 != clock_gettime(CLOCK_MONOTONIC, &now)) {
#else
if (0 != clock_gettime(CLOCK_MONOTONIC_RAW, &now)) {
#endif
DEBUG_WARNING("jiffies: clock_gettime() failed (%m)\n", errno);
return 0;
}
Expand Down

0 comments on commit a6849dd

Please sign in to comment.