Created
April 4, 2017 13:50
-
-
Save galek/13da74ca4f7b47e6ce5c1b263a78ee05 to your computer and use it in GitHub Desktop.
Clocks
This file contains hidden or 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
static inline uint64_t cf_getms() | |
{ | |
struct timespec ts; | |
clock_gettime(CLOCK_MONOTONIC, &ts); | |
return ((uint64_t)ts.tv_nsec / 1000000) + ((uint64_t)ts.tv_sec * 1000); | |
} | |
static inline uint64_t cf_getus() | |
{ | |
struct timespec ts; | |
clock_gettime(CLOCK_MONOTONIC, &ts); | |
return ((uint64_t)ts.tv_nsec / 1000) + ((uint64_t)ts.tv_sec * 1000000); | |
} | |
static inline uint64_t | |
cf_getns() | |
{ | |
struct timespec ts; | |
clock_gettime(CLOCK_MONOTONIC, &ts); | |
return (uint64_t)ts.tv_nsec + ((uint64_t)ts.tv_sec * 1000000000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment