1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-19 15:14:48 +00:00

Mac clock shim not needed until 10.12

This commit is contained in:
Jason Pepas 2022-03-21 20:20:20 -05:00
parent d77be46644
commit c9986936ed

View File

@ -789,11 +789,6 @@ int32_t janet_sorted_keys(const JanetKV *dict, int32_t cap, int32_t *index_buffe
/* Clock shims for various platforms */ /* Clock shims for various platforms */
#ifdef JANET_GETTIME #ifdef JANET_GETTIME
/* For macos */
#ifdef JANET_APPLE
#include <mach/clock.h>
#include <mach/mach.h>
#endif
#ifdef JANET_WINDOWS #ifdef JANET_WINDOWS
int janet_gettime(struct timespec *spec) { int janet_gettime(struct timespec *spec) {
FILETIME ftime; FILETIME ftime;
@ -806,7 +801,10 @@ int janet_gettime(struct timespec *spec) {
spec->tv_nsec = wintime % 10000000LL * 100; spec->tv_nsec = wintime % 10000000LL * 100;
return 0; return 0;
} }
#elif defined(JANET_APPLE) /* clock_gettime() wasn't available on Mac until 10.12. */
#elif defined(JANET_APPLE) && !defined(MAC_OS_X_VERSION_10_12)
#include <mach/clock.h>
#include <mach/mach.h>
int janet_gettime(struct timespec *spec) { int janet_gettime(struct timespec *spec) {
clock_serv_t cclock; clock_serv_t cclock;
mach_timespec_t mts; mach_timespec_t mts;