diff --git a/utils.c b/utils.c index e59002e..5d9d5aa 100644 --- a/utils.c +++ b/utils.c @@ -56,7 +56,7 @@ void *__calloc_a(size_t len, ...) return ret; } -#ifdef __APPLE__ +#ifdef LIBUBOX_COMPAT_CLOCK_GETTIME #include /* host_get_clock_service() */ #include /* mach_port_deallocate() */ #include /* mach_host_self(), mach_task_self() */ diff --git a/utils.h b/utils.h index 803150b..cd09cc0 100644 --- a/utils.h +++ b/utils.h @@ -57,7 +57,8 @@ extern int __BUILD_BUG_ON_CONDITION_FAILED; #define BUILD_BUG_ON __BUILD_BUG_ON #endif -#ifdef __APPLE__ +#if defined(__APPLE__) && !defined(CLOCK_MONOTONIC) +#define LIBUBOX_COMPAT_CLOCK_GETTIME #include #define CLOCK_REALTIME CALENDAR_CLOCK