From 4adf25952f8af0a8b61b3737b46c6a7146fd034a Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Sun, 28 Dec 2014 13:10:27 -0500 Subject: systemtime: Fix includes and check for _POSIX_TIMERS Fix missing include of windows.h on windows platform. Change check for _POSIX_TIMERS to check that it is greater than 0. On OS X, the POSIX timers are not available and _POSIX_TIMERS is -1. --- src/systemtime.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/systemtime.c') diff --git a/src/systemtime.c b/src/systemtime.c index 12b74cc..84106c5 100644 --- a/src/systemtime.c +++ b/src/systemtime.c @@ -18,17 +18,22 @@ */ #include +#include #ifndef _WIN32 -# ifdef _POSIX_TIMERS +# if _POSIX_TIMERS > 0 # include # else # include # endif +#else +# include #endif #include "systemtime.h" + +/* Return current time in T as the number of seconds since the epoch. */ int systemtime_get_time(double *t) { @@ -41,7 +46,7 @@ systemtime_get_time(double *t) /* FILETIME is tenths of microseconds since 1601-01-01 UTC */ *t = (i.QuadPart / 10000000.0) - 11644473600.0; -#elif defined(_POSIX_TIMERS) /* POSIX timers */ +#elif _POSIX_TIMERS > 0 /* POSIX timers */ struct timespec now; int r = clock_gettime(CLOCK_REALTIME, &now); if (r < 0) { -- cgit v1.2.3-70-g09d2