# HG changeset patch
# User Matthias Ringwald <matthias@ringwald.ch>
# Date 1244378986 -7200
# Node ID 575bbf0a2d486dec2e89c1de3dd588395d252dae
# Parent  036dc985c592df38112b3375d4353fb7659c321d
Fix _x_compute_interval for OS X.

The new _x_compute_interval functions uses clock_gettime() which is
not provided on OS X. If _POSIX_TIMERS is not defined, use the older
gettimeofday().

diff -r 036dc985c592 -r 575bbf0a2d48 src/xine-engine/demux.c
--- a/src/xine-engine/demux.c Sun May 31 20:50:13 2009 -0400
+++ b/src/xine-engine/demux.c Sun Jun 07 14:49:46 2009 +0200
@@ -132,11 +132,17 @@
  ui.QuadPart  += millisecs * 10000;
  ts.tv_sec = ui.QuadPart / 10000000;
  ts.tv_sec = (ui.QuadPart % 10000000)*100;
-#else
+#elif _POSIX_TIMERS > 0
  clock_gettime(CLOCK_REALTIME, &ts);
  uint64_t ttimer = (uint64_t)ts.tv_sec*1000 + ts.tv_nsec/1000000 + millisecs;
  ts.tv_sec = ttimer/1000;
  ts.tv_nsec = (ttimer%1000)*1000000;
+#else
+  struct timeval tv;
+  gettimeofday(&tv, NULL);
+  uint64_t ttimer = (uint64_t)tv.tv_sec*1000 + tv.tv_usec/1000 + millisecs;
+  ts.tv_sec = ttimer/1000;
+  ts.tv_nsec = (ttimer%1000)*1000000;
#endif
  return ts;
}