From 8a6261d7c2202bc06c869fbd51e5c037f32941c8 Mon Sep 17 00:00:00 2001 From: Michael Norton <26778057+mikenor@users.noreply.github.com> Date: Sun, 31 Mar 2019 15:15:59 -0600 Subject: [PATCH] Header typedef workaround for newer MacOS versions Newish version of MacOS's time.h already `typedef`s `clockid_t` but doesn't seem to `#define` anything indicating such; as a workaround assume that `#ifdef CLOCK_MONOTONIC` on a Mac means that `clockid_t` has been `typedef`'d. --- compat/clock_gettime/clock_gettime.h | 8 ++++++++ compat/clock_nanosleep/clock_nanosleep.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/compat/clock_gettime/clock_gettime.h b/compat/clock_gettime/clock_gettime.h index 83fdac7..3c4c29b 100644 --- a/compat/clock_gettime/clock_gettime.h +++ b/compat/clock_gettime/clock_gettime.h @@ -3,9 +3,17 @@ #include // Apple-only, but this isn't inclued on other BSDs +#ifdef __OpenBSD__ #ifdef _CLOCKID_T_DEFINED_ #define CLOCKID_T #endif +#endif + +#ifdef __APPLE__ +#ifdef CLOCK_MONOTONIC +#define CLOCKID_T +#endif +#endif #ifndef CLOCKID_T #define CLOCKID_T diff --git a/compat/clock_nanosleep/clock_nanosleep.h b/compat/clock_nanosleep/clock_nanosleep.h index 9a8da5d..34eb801 100644 --- a/compat/clock_nanosleep/clock_nanosleep.h +++ b/compat/clock_nanosleep/clock_nanosleep.h @@ -1,9 +1,17 @@ #ifndef CLOCK_NANOSLEEP_H #define CLOCK_NANOSLEEP_H +#ifdef __OpenBSD__ #ifdef _CLOCKID_T_DEFINED_ #define CLOCKID_T #endif +#endif + +#ifdef __APPLE__ +#ifdef CLOCK_MONOTONIC +#define CLOCKID_T +#endif +#endif #ifndef CLOCKID_T #define CLOCKID_T