struct timeval *pa_rtclock_get(struct timeval *tv) {
#ifdef HAVE_CLOCK_GETTIME
- static int no_monotonic = 0;
struct timespec ts;
- /* No locking or atomic ops for no_monotonic here */
-
- if (!no_monotonic) {
#ifdef CLOCK_MONOTONIC
- if (clock_gettime(CLOCK_MONOTONIC, &ts) >= 0)
- goto out;
-#endif
+ /* No locking or atomic ops for no_monotonic here */
+ static pa_bool_t no_monotonic = FALSE;
- no_monotonic = 1;
- }
+ if (!no_monotonic)
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0)
+ no_monotonic = TRUE;
- pa_assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
+ if (no_monotonic)
+#endif
+ pa_assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
-out:
pa_assert(tv);
tv->tv_sec = ts.tv_sec;