Commit 58bae569 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix monotonic clock POSIX option detection

parent 402b2ed2
...@@ -190,7 +190,7 @@ mtime_t mdate( void ) ...@@ -190,7 +190,7 @@ mtime_t mdate( void )
#elif defined (HAVE_CLOCK_GETTIME) #elif defined (HAVE_CLOCK_GETTIME)
struct timespec ts; struct timespec ts;
# ifdef _POSIX_MONOTONIC_CLOCK # if (_POSIX_MONOTONIC_CLOCK >= 0)
/* Try to use POSIX monotonic clock if available */ /* Try to use POSIX monotonic clock if available */
if( clock_gettime( CLOCK_MONOTONIC, &ts ) ) if( clock_gettime( CLOCK_MONOTONIC, &ts ) )
# endif # endif
...@@ -257,7 +257,7 @@ void mwait( mtime_t date ) ...@@ -257,7 +257,7 @@ void mwait( mtime_t date )
ts.tv_sec = d.quot; ts.tv_sec = d.quot;
ts.tv_nsec = d.rem * 1000; ts.tv_nsec = d.rem * 1000;
# ifdef _POSIX_MONOTONIC_CLOCK # if (_POSIX_MONOTONIC_CLOCK >= 0)
if( clock_nanosleep( CLOCK_MONOTONIC, 0 /*TIMER_ABSTIME*/, &ts, NULL ) ) if( clock_nanosleep( CLOCK_MONOTONIC, 0 /*TIMER_ABSTIME*/, &ts, NULL ) )
# endif # endif
(void)clock_nanosleep( CLOCK_REALTIME, 0, &ts, NULL ); (void)clock_nanosleep( CLOCK_REALTIME, 0, &ts, NULL );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment