Created
May 19, 2013 11:53
-
-
Save sebmck/5607450 to your computer and use it in GitHub Desktop.
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
uint64_t uv__hrtime(void) { | |
mach_timebase_info_data_t info; | |
if (mach_timebase_info(&info) != KERN_SUCCESS) | |
abort(); | |
return mach_absolute_time() * info.numer / info.denom; | |
} |
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
uint64_t uv__hrtime(void) { | |
struct timespec ts; | |
clock_gettime(CLOCK_MONOTONIC, &ts); | |
return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment