Skip to content

Commit 14d6f57

Browse files
committed
Use monotonic clock on OpenBSD
OpenBSD does not implement a complete suite of POSIX timers, but does have clock_gettime() and CLOCK_MONOTONIC.
1 parent 52645d6 commit 14d6f57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

utp_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static uint64 __GetMicroseconds()
143143

144144
#else // !__APPLE__
145145

146-
#if ! (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 && defined(CLOCK_MONOTONIC))
146+
#if ! ((defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 && defined(CLOCK_MONOTONIC)) || defined(__OpenBSD__))
147147
#pragma message ("Using non-monotonic function gettimeofday() in UTP_GetMicroseconds()")
148148
#endif
149149

@@ -155,7 +155,7 @@ static uint64_t __GetMicroseconds()
155155
{
156156
struct timeval tv;
157157

158-
#if defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 && defined(CLOCK_MONOTONIC)
158+
#if ((defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 && defined(CLOCK_MONOTONIC)) || defined(__OpenBSD__))
159159
static int have_posix_clocks = -1;
160160
int rc;
161161

0 commit comments

Comments
 (0)