blob: fd31765c56f0d06188f3f07d4c797456c16b358b [file] [log] [blame]
diff --git a/src/rdtime.h b/src/rdtime.h
index 04144227..0ccc8312 100644
--- a/src/rdtime.h
+++ b/src/rdtime.h
@@ -169,7 +169,13 @@ static RD_INLINE void rd_timeout_init_timespec (struct timespec *tspec,
tspec->tv_sec = timeout_ms;
tspec->tv_nsec = 0;
} else {
+#ifdef __APPLE__
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ TIMEVAL_TO_TIMESPEC(&tv, tspec);
+#else
timespec_get(tspec, TIME_UTC);
+#endif
tspec->tv_sec += timeout_ms / 1000;
tspec->tv_nsec += (timeout_ms % 1000) * 1000000;
if (tspec->tv_nsec >= 1000000000) {