Commit 294fb52e authored by David Gibson's avatar David Gibson

time: Change TIME_HAVE_MONOTONIC to be 0/1 rather than defined/undefined

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: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent 615189ae
...@@ -28,7 +28,7 @@ struct timeabs time_now(void) ...@@ -28,7 +28,7 @@ struct timeabs time_now(void)
struct timemono time_mono(void) struct timemono time_mono(void)
{ {
struct timemono ret; struct timemono ret;
#ifdef TIME_HAVE_MONOTONIC #if TIME_HAVE_MONOTONIC
clock_gettime(CLOCK_MONOTONIC, &ret.ts); clock_gettime(CLOCK_MONOTONIC, &ret.ts);
#else /* Best we can do */ #else /* Best we can do */
ret.ts = time_now().ts; ret.ts = time_now().ts;
......
...@@ -71,6 +71,8 @@ struct timemono { ...@@ -71,6 +71,8 @@ struct timemono {
*/ */
#if HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC) #if HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC)
#define TIME_HAVE_MONOTONIC 1 #define TIME_HAVE_MONOTONIC 1
#else
#define TIME_HAVE_MONOTONIC 0
#endif #endif
struct timespec time_check_(struct timespec in, const char *abortstr); struct timespec time_check_(struct timespec in, const char *abortstr);
......
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