]> granicus.if.org Git - check/commitdiff
clock_gettime.c: Use __APPLE__ instead of __MACH__
authorNirbheek Chauhan <nirbheek@centricular.com>
Wed, 2 Nov 2016 08:37:20 +0000 (14:07 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Wed, 2 Nov 2016 08:37:20 +0000 (14:07 +0530)
Hurd also defines __MACH__, but it does not have mach_absolute_time. Use
the more strict __APPLE__ instead.

lib/clock_gettime.c

index 6b37769d3186c76589814ded165767a84f6d3a04..d9e354debde18b6579f1ec37dfa0612e307e4929 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "libcompat.h"
 
-#ifdef __MACH__
+#ifdef __APPLE__
 #include <mach/clock.h>
 #include <mach/mach.h>
 #include <mach/mach_time.h>
@@ -35,8 +35,9 @@
 int clock_gettime(clockid_t clk_id CK_ATTRIBUTE_UNUSED, struct timespec *ts)
 {
 
-#ifdef __MACH__
-    /* OS X does not have clock_gettime, use mach_absolute_time */
+#ifdef __APPLE__
+    /* Some versions of macOS and iOS do not have clock_gettime, use
+     * mach_absolute_time */
 
     static mach_timebase_info_data_t sTimebaseInfo;
     uint64_t rawTime;