]> git.ozlabs.org Git - ccan/commitdiff
time: Change TIME_HAVE_MONOTONIC to be 0/1 rather than defined/undefined
authorDavid Gibson <david@gibson.dropbear.id.au>
Mon, 21 Nov 2016 13:52:53 +0000 (00:52 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 21 Nov 2016 13:52:53 +0000 (00:52 +1100)
Generally, ccan config variables are always defined as either 0 or 1 and
are tested with #if.  That's instead of being being either defined or
undefined and tested with #ifdef.

TIME_HAVE_MONOTONIC breaks that convention.  This can cause warnings in
ccan/timer which uses it assuming the 0/1 convention.  Change it to remove
that warning.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
ccan/time/time.c
ccan/time/time.h

index 27f0d52a30987df194ea710e8f4af6a4cd74dfc4..9810792280c775b2c2d49975739ae34c56af2b67 100644 (file)
@@ -28,7 +28,7 @@ struct timeabs time_now(void)
 struct timemono time_mono(void)
 {
        struct timemono ret;
-#ifdef TIME_HAVE_MONOTONIC
+#if TIME_HAVE_MONOTONIC
        clock_gettime(CLOCK_MONOTONIC, &ret.ts);
 #else /* Best we can do */
        ret.ts = time_now().ts;
index 70ebdc9a7751ca5be434329421618c58f177c9c7..6ab61a99c3a5108fc1a391b2549178c536cf60c9 100644 (file)
@@ -71,6 +71,8 @@ struct timemono {
  */
 #if HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC)
 #define TIME_HAVE_MONOTONIC 1
+#else
+#define TIME_HAVE_MONOTONIC 0
 #endif
 
 struct timespec time_check_(struct timespec in, const char *abortstr);