X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Ftime.h;h=593a92ab074f410b2e55ac14dfb93706818e9a0b;hb=214f70e02431aeebcf2d297c88f4add2e23ffe3f;hp=f51075dc39c3e35a3ebd13ad0fc9b61b0bb2a7e4;hpb=389fbf04b41e2002be44a1e3392bfade2f1deeef;p=lttng-tools.git diff --git a/src/common/compat/time.h b/src/common/compat/time.h index f51075dc3..593a92ab0 100644 --- a/src/common/compat/time.h +++ b/src/common/compat/time.h @@ -26,12 +26,24 @@ #include #ifdef __APPLE__ + typedef uint64_t timer_t; -typedef int clockid_t; #include #include +#include + +#undef NSEC_PER_SEC +#undef NSEC_PER_MSEC +#undef NSEC_PER_USEC +#undef USEC_PER_SEC + +#endif /* __APPLE__ */ + +/* macOS/OS X 10.12 (Sierra) and up provide clock_gettime() */ +#if defined(__APPLE__) && !defined(LTTNG_HAVE_CLOCK_GETTIME) +typedef int clockid_t; #define CLOCK_REALTIME CALENDAR_CLOCK #define CLOCK_MONOTONIC SYSTEM_CLOCK @@ -65,7 +77,7 @@ end: return ret; } -#else /* __APPLE__ */ +#else /* __APPLE__ && !LTTNG_HAVE_CLOCK_GETTIME */ static inline int lttng_clock_gettime(clockid_t clk_id, struct timespec *tp) @@ -73,6 +85,6 @@ int lttng_clock_gettime(clockid_t clk_id, struct timespec *tp) return clock_gettime(clk_id, tp); } -#endif /* __APPLE__ */ +#endif /* __APPLE__ && !LTTNG_HAVE_CLOCK_GETTIME */ #endif /* _COMPAT_TIME_H */