]> git.sesse.net Git - vlc/commitdiff
Fix the absolute POSIX timer and use it
authorRémi Denis-Courmont <rem@videolan.org>
Tue, 21 Nov 2006 18:40:42 +0000 (18:40 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Tue, 21 Nov 2006 18:40:42 +0000 (18:40 +0000)
src/misc/mtime.c

index 4e085e27fef37ccb326f401a6f4615a4b68df5a4..0388a67f6375ecd85ccf1a0a9218eb03395c022d 100644 (file)
@@ -242,20 +242,13 @@ void mwait( mtime_t date )
     msleep( delay );
 
 #elif defined (HAVE_CLOCK_NANOSLEEP)
-# if defined (HAVE_TIMER_ABSTIME_THAT_ACTUALLY_WORKS_WELL)
     lldiv_t d = lldiv( date, 1000000 );
-    struct timespec ts = { d.quot, d.rem };
+    struct timespec ts = { d.quot, d.rem * 1000 };
 
-#  if (_POSIX_MONOTONIC_CLOCK - 0 >= 0)
+# if (_POSIX_MONOTONIC_CLOCK - 0 >= 0)
     if( clock_nanosleep( CLOCK_MONOTONIC, TIMER_ABSTIME, &ts, NULL ) )
-#  endif
-        clock_nanosleep( CLOCK_REALTIME, TIMER_ABSTIME, &ts, NULL );
-# else
-    date -= mdate ();
-    if( date <= 0)
-        return;
-    msleep( date );
 # endif
+        clock_nanosleep( CLOCK_REALTIME, TIMER_ABSTIME, &ts, NULL );
 #else
 
     struct timeval tv_date;