HACKishly avoid clock_gettime() build issue with Xcode 8

This commit is contained in:
Aaron Culliney 2016-10-16 18:51:50 -07:00
parent a6516fc1ad
commit 300c292ec5
2 changed files with 10 additions and 4 deletions

View File

@ -34,7 +34,7 @@ static __attribute__((constructor)) void __init_darwin_shim(void) {
emulator_registerStartupCallback(CTOR_PRIORITY_LATE, &_init_darwin_shim);
}
int clock_gettime(int clk_id, struct timespec *tp) {
int my_clock_gettime(int clk_id, struct timespec *tp) {
double diff = (mach_absolute_time() - orwl_timestart) * orwl_timebase;
tp->tv_sec = diff * ORWL_NANO;
tp->tv_nsec = diff - (tp->tv_sec * ORWL_GIGA);

View File

@ -16,10 +16,16 @@
#ifdef __APPLE__
#define CLOCK_MONOTONIC 1
#define CLOCK_REALTIME 2
#if !defined(CLOCK_MONOTONIC)
# define CLOCK_MONOTONIC 1
#endif
#if !defined(CLOCK_REALTIME)
# define CLOCK_REALTIME 2
#endif
int clock_gettime(int, struct timespec *);
#define clock_gettime my_clock_gettime
int my_clock_gettime(int, struct timespec *);
#endif // __APPLE__