X-Git-Url: https://unix4lyfe.org/gitweb/darkstat/blobdiff_plain/30e036611251263d4194236a659ba6189ecbec47..0736c704e88399324e1a3c5d484cb116458c23b1:/now.c diff --git a/now.c b/now.c index 0bc0061..b1a43cb 100644 --- a/now.c +++ b/now.c @@ -23,7 +23,8 @@ #include #include -#ifdef __MACH__ /* Fake up clock_gettime() on OS X. */ +#if defined(__MACH__) && !defined(__gnu_hurd__) +/* Fake up clock_gettime() on OS X. */ # include # include # include @@ -119,14 +120,14 @@ void now_update(void) { all_clocks_update(); } -time_t mono_to_real(const time_t t) { +time_t mono_to_real(const int64_t t) { assert(now_initialized); - return t - clock_mono.tv_sec + clock_real.tv_sec; + return (time_t)(t - (int64_t)clock_mono.tv_sec + (int64_t)clock_real.tv_sec); } -time_t real_to_mono(const time_t t) { +int64_t real_to_mono(const time_t t) { assert(now_initialized); - return t - clock_real.tv_sec + clock_mono.tv_sec; + return (int64_t)(t - clock_real.tv_sec + clock_mono.tv_sec); } void timer_start(struct timespec *t) {