-#if defined(__APPLE__) && !defined(__powerpc__) && !defined( __ppc__ ) && !defined( __ppc64__ )
- /* mdate() is the monotonic clock, timedwait origin is gettimeofday() which
- * isn't monotonic. Use imedwait_relative_np() instead
- */
- mtime_t base = mdate();
- deadline -= base;
- if (deadline < 0)
- deadline = 0;
+#if (_POSIX_MONOTONIC_CLOCK > 0) && (_POSIX_CLOCK_SELECTION < 0)
+ /* Without clock selection, the real-time clock is used for the absolute
+ * timeout in pthread_cond_timedwait(). We may need to adjust. */
+# error FIXME: breaks vlc_cond_init_daytime()
+ if (vlc_clock_id != CLOCK_REALTIME)
+ {
+ struct timeval tv;
+
+ deadline -= mdate ();
+ gettimeofday (&tv, NULL);
+ deadline += tv.tv_sec * UINT64_C(1000000) + tv.tv_usec;
+ }
+#endif