]> git.sesse.net Git - vlc/commitdiff
_POSIX_CLOCK_SELECTION at 0 does not mean it's not supported.
authorRémi Denis-Courmont <rem@videolan.org>
Tue, 18 Dec 2007 20:40:46 +0000 (20:40 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Tue, 18 Dec 2007 20:40:46 +0000 (20:40 +0000)
src/misc/mtime.c
src/misc/threads.c

index fc18906ce9d1fc31f2d25ae05c2fcb848451391b..d89bbf9352aefc0e90f4abb94839c53393544297 100644 (file)
@@ -67,16 +67,17 @@ struct timespec
 int nanosleep(struct timespec *, struct timespec *);
 #endif
 
-#ifdef HAVE_CLOCK_NANOSLEEP
-#  if !defined _POSIX_CLOCK_SELECTION || (_POSIX_CLOCK_SELECTION - 0 <= 0)
+#if (!defined (_POSIX_CLOCK_SELECTION)) || (_POSIX_CLOCK_SELECTION < 0)
 /*
  * We cannot use the monotonic clock is clock selection is not available,
  * as it would screw vlc_cond_timedwait() completely. Instead, we have to
  * stick to the realtime clock. Nevermind it screws everything when ntpdate
  * warps the wall clock.
  */
-#    undef CLOCK_MONOTONIC
-#    define CLOCK_MONOTONIC CLOCK_REALTIME
+#  undef CLOCK_MONOTONIC
+#  define CLOCK_MONOTONIC CLOCK_REALTIME
+#  ifndef HAVE_CLOCK_NANOSLEEP
+#   error We have quite a situation here! Fix me if it ever happens.
 #  endif
 #endif
 
index d8fdced017b184d18c9391b862d6db44186efa8c..affdc2276fb39df6fb6b0d119f025f6f6f3c2740 100644 (file)
@@ -484,7 +484,7 @@ int __vlc_cond_init( vlc_object_t *p_this, vlc_cond_t *p_condvar )
     if (ret)
         return ret;
 
-# if defined (_POSIX_CLOCK_SELECTION) && (_POSIX_CLOCK_SELECTION - 0 > 0)
+# if defined (_POSIX_CLOCK_SELECTION) && (_POSIX_CLOCK_SELECTION >= 0)
     /* NOTE: This must be the same clock as the one in mtime.c */
     pthread_condattr_setclock (&attr, CLOCK_MONOTONIC);
 # endif