Created
March 8, 2019 08:12
-
-
Save tanakamura/36cea8dab35aa0995ef98955b469cdf2 to your computer and use it in GitHub Desktop.
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 double getsec() | |
{ | |
struct timespec ts; | |
clock_gettime(CLOCK_MONOTONIC, &ts); | |
return (ts.tv_nsec / 1e9) + ts.tv_sec; | |
} | |
static double get_sec() { | |
struct timespec ts; | |
clock_gettime(CLOCK_MONOTONIC, &ts); | |
return ts.tv_sec + ts.tv_nsec/(1000000000.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment