Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tanakamura/36cea8dab35aa0995ef98955b469cdf2 to your computer and use it in GitHub Desktop.
Save tanakamura/36cea8dab35aa0995ef98955b469cdf2 to your computer and use it in GitHub Desktop.
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