Skip to content

Instantly share code, notes, and snippets.

@denofevil
Last active December 17, 2015 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denofevil/db57fa547510b2dd87fd to your computer and use it in GitHub Desktop.
Save denofevil/db57fa547510b2dd87fd to your computer and use it in GitHub Desktop.
Mac nano patch
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