X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftime%2Ftime.c;h=9810792280c775b2c2d49975739ae34c56af2b67;hb=d16685e327c01b79bf4b49793f56cbe3e33ff179;hp=8e7fbffe739da0ba6cebed78b8c7624023269e1b;hpb=95ff2139520130dd98a0503e3c4f441c69a68f5a;p=ccan diff --git a/ccan/time/time.c b/ccan/time/time.c index 8e7fbffe..98107922 100644 --- a/ccan/time/time.c +++ b/ccan/time/time.c @@ -3,7 +3,7 @@ #include #include -#if !HAVE_CLOCK_GETTIME && !HAVE_CLOCK_GETTIME_IN_LIBRT +#if !HAVE_CLOCK_GETTIME #include struct timeabs time_now(void) @@ -23,17 +23,17 @@ struct timeabs time_now(void) clock_gettime(CLOCK_REALTIME, &ret.ts); return TIMEABS_CHECK(ret); } -#endif /* HAVE_CLOCK_GETTIME || HAVE_CLOCK_GETTIME_IN_LIBRT */ +#endif /* HAVE_CLOCK_GETTIME */ 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; #endif /* !HAVE_TIME_MONOTONIC */ - return ret; + return TIMEMONO_CHECK(ret); } struct timerel time_divide(struct timerel t, unsigned long div) @@ -128,3 +128,11 @@ struct timeabs timeabs_check(struct timeabs t, const char *abortstr) ret.ts = time_check_(t.ts, abortstr); return ret; } + +struct timemono timemono_check(struct timemono t, const char *abortstr) +{ + struct timemono ret; + + ret.ts = time_check_(t.ts, abortstr); + return ret; +}