-
-
Save denofevil/db57fa547510b2dd87fd to your computer and use it in GitHub Desktop.
Mac nano patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/os/bsd/vm/os_bsd.cpp b/src/os/bsd/vm/os_bsd.cpp | |
--- a/src/os/bsd/vm/os_bsd.cpp | |
+++ b/src/os/bsd/vm/os_bsd.cpp | |
@@ -107,6 +107,7 @@ | |
#ifdef __APPLE__ | |
# include <mach/mach.h> // semaphore_* API | |
+# include <mach/mach_time.h> | |
# include <mach-o/dyld.h> | |
# include <sys/proc_info.h> | |
# include <objc/objc-auto.h> | |
@@ -956,8 +957,19 @@ | |
#endif | |
#ifdef __APPLE__ | |
+int clock_get_time(int clk_id, struct timespec *tp) { | |
+ uint64_t tm; | |
+ static mach_timebase_info_data_t timebase_info= {0,0}; | |
+ if (timebase_info.denom == 0) | |
+ (void) mach_timebase_info(&timebase_info); | |
+ tm = mach_absolute_time(); | |
+ tp->tv_sec = 0; | |
+ tp->tv_nsec = (tm * timebase_info.numer) / timebase_info.denom; | |
+ return 0; | |
+} | |
+ | |
void os::Bsd::clock_init() { | |
- // XXXDARWIN: Investigate replacement monotonic clock | |
+ _clock_gettime = ::clock_get_time; | |
} | |
#else | |
void os::Bsd::clock_init() { | |
[2.0.0-ruby] denofevil@Deniss-M |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment