summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Ringwald <matthias@ringwald.ch>2009-06-07 14:49:46 +0200
committerMatthias Ringwald <matthias@ringwald.ch>2009-06-07 14:49:46 +0200
commit5c87eda95d1cab1a43e5118070d506077be09fcf (patch)
tree4cc78a08c92299637b07d89213005e13b41b85b3
parente559c4abdd23b9e41922329b73909acbacbcdffc (diff)
downloadxine-lib-5c87eda95d1cab1a43e5118070d506077be09fcf.tar.gz
xine-lib-5c87eda95d1cab1a43e5118070d506077be09fcf.tar.bz2
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().
-rw-r--r--src/xine-engine/demux.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c
index 158e0706f..98b2e3fd3 100644
--- a/src/xine-engine/demux.c
+++ b/src/xine-engine/demux.c
@@ -132,11 +132,17 @@ static struct timespec _x_compute_interval(unsigned int millisecs) {
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;
}