mirror of
https://github.com/janet-lang/janet
synced 2025-01-14 09:25:41 +00:00
Merge pull request #937 from cellularmitosis/clock1012
Mac clock shim not needed after 10.12
This commit is contained in:
commit
9d0da74347
@ -39,10 +39,6 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#ifdef JANET_APPLE
|
|
||||||
#include <AvailabilityMacros.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef JANET_WINDOWS
|
#ifdef JANET_WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
@ -67,12 +63,6 @@ extern char **environ;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* For macos */
|
|
||||||
#ifdef JANET_APPLE
|
|
||||||
#include <mach/clock.h>
|
|
||||||
#include <mach/mach.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Not POSIX, but all Unixes but Solaris have this function. */
|
/* Not POSIX, but all Unixes but Solaris have this function. */
|
||||||
#if defined(JANET_POSIX) && !defined(__sun)
|
#if defined(JANET_POSIX) && !defined(__sun)
|
||||||
time_t timegm(struct tm *tm);
|
time_t timegm(struct tm *tm);
|
||||||
|
@ -36,6 +36,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef JANET_APPLE
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
/* Base 64 lookup table for digits */
|
/* Base 64 lookup table for digits */
|
||||||
@ -789,11 +793,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 +805,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;
|
||||||
|
Loading…
Reference in New Issue
Block a user