summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOscar Lim <olim@ucla.edu>2016-09-27 22:49:47 -0700
committerOscar Lim <olim@ucla.edu>2016-09-28 22:57:43 -0700
commit04b8076512ef71fac5a26cbe85f8d820bd3ccfea (patch)
tree00dcde413da94404dd6bc0da902b9aa4f8d9250c /src
parent5e172430e57c1349485a151fa8000b12071a4671 (diff)
downloadluasystem-04b8076512ef71fac5a26cbe85f8d820bd3ccfea.zip
Fix `clock_gettime` for Mac OS X 10.12
Diffstat (limited to 'src')
-rw-r--r--src/time.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/time.c b/src/time.c
index 2c58950..8c6a4f2 100644
--- a/src/time.c
+++ b/src/time.c
@@ -10,8 +10,16 @@
#include <sys/time.h>
#endif
-#ifndef HAVE_CLOCK_GETTIME
#ifdef __APPLE__
+#include <AvailabilityMacros.h>
+
+#ifndef MAC_OS_X_VERSION_10_12
+#define MAC_OS_X_VERSION_10_12 101200
+#endif
+
+#define HAVE_CLOCK_GETTIME (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12 || defined(CLOCK_MONOTONIC))
+
+#if !(HAVE_CLOCK_GETTIME)
#include "time_osx.h"
#endif
#endif