From c159a45df11dff55821a9dda0ad613628df1bc8e Mon Sep 17 00:00:00 2001 From: hniksic Date: Thu, 7 Apr 2005 16:38:08 -0700 Subject: [PATCH] [svn] Check that _POSIX_CLOCK_MONOTONIC >= 0 before using it. --- src/ChangeLog | 3 +++ src/ptimer.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index bddaa88c..a2a62106 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2005-04-08 Hrvoje Niksic + * ptimer.c (ptimer_init): In fact, _POSIX_MONOTONIC_CLOCK needs to + be >= 0. + * ptimer.c (ptimer_init): Check whether _POSIX_MONOTONIC_CLOCK is defined instead of whether it's greater than 0. glibc defines it to 0, but still makes it available via sysconf. diff --git a/src/ptimer.c b/src/ptimer.c index 45a389a8..47980cfc 100644 --- a/src/ptimer.c +++ b/src/ptimer.c @@ -183,7 +183,7 @@ ptimer_init (void) { struct timespec res; -#ifdef _POSIX_MONOTONIC_CLOCK +#if _POSIX_MONOTONIC_CLOCK >= 0 /* -1 means not supported */ if (sysconf (_SC_MONOTONIC_CLOCK) > 0) posix_clock_id = CLOCK_MONOTONIC; else -- 2.39.2