X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Ftime.h;h=17447b3724bee5ef4c0bf0a30a080317f40d7748;hp=c8d5859ff9ef22ea8b48c5d3429752342ed89120;hb=707de922fab70af1b4238c33359b77d1ebd1ee34;hpb=395d6b02dda3db1acd08936f49c1dc8efc48e613 diff --git a/src/common/compat/time.h b/src/common/compat/time.h index c8d5859ff..17447b372 100644 --- a/src/common/compat/time.h +++ b/src/common/compat/time.h @@ -26,8 +26,8 @@ #include #ifdef __APPLE__ + typedef uint64_t timer_t; -typedef int clockid_t; #include #include @@ -36,6 +36,12 @@ typedef int clockid_t; #undef NSEC_PER_MSEC #undef NSEC_PER_USEC +#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 @@ -69,7 +75,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) @@ -77,6 +83,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 */