mach: clock_gettime and friends appeared in Mac OSX 10.12 49/head
authorSebastian Wiedenroth <wiedi@frubar.net>
Tue, 30 Jan 2018 19:25:14 +0000 (20:25 +0100)
committerSebastian Wiedenroth <wiedi@frubar.net>
Tue, 30 Jan 2018 19:25:14 +0000 (20:25 +0100)
Signed-off-by: Sebastian Wiedenroth <wiedi@frubar.net>
src/mach/clock_gettime.c
src/mach/clock_gettime.h

index c34c164..21a90ca 100644 (file)
@@ -45,6 +45,8 @@
 
 #include "clock_gettime.h"
 
+#ifndef CLOCK_MONOTONIC
+
 #include <err.h>
 #include <mach/clock.h>
 #include <mach/mach.h>
@@ -72,3 +74,5 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp) {
 
   return retval;
 }
+
+#endif /* CLOCK_MONOTONIC */
\ No newline at end of file
index 5039c19..cef4aed 100644 (file)
 
 #include <time.h>
 
+#ifndef CLOCK_MONOTONIC /* available since OSX 10.12 */
+
 #define CLOCK_MONOTONIC 1      /* Per Linux's time.h */
 typedef int clockid_t; /* Per Linux's types.h, posix_types.h */
 
 /* Per the POSIX Realtime Extensions */
 int clock_gettime(clockid_t clock_id, struct timespec *tp);
 
+#endif /* CLOCK_MONOTONIC */
+
 #endif /* __MACH__ */
 
 #endif /* _MACH_CLOCK_GETTIME_H_ */