Created
August 18, 2017 01:12
-
-
Save hirokuma/17bdf87bf3c8c6f29008e74635f9984e to your computer and use it in GitHub Desktop.
clock_gettime()
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
#include <stdio.h> | |
#include <time.h> | |
int main(void) | |
{ | |
struct timespec ts; | |
int ret = clock_gettime(CLOCK_REALTIME, &ts); | |
if (ret == 0) { | |
printf("tv_sec=%lu, tv_nsec=%ld\n", (unsigned long)ts.tv_sec, ts.tv_nsec); | |
} else { | |
perror("clock_gettime"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment