Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sys/time.h>
- #include <stdio.h>
- int main () {
- struct timeval startTime;
- gettimeofday(&startTime, NULL);
- struct timeval endTime;
- gettimeofday(&endTime, NULL);
- printf("Start time: %li\n", startTime.tv_sec * (int)1e6 + startTime.tv_usec);
- printf("End time: %li\n", endTime.tv_sec * (int)1e6 + endTime.tv_usec);
- printf("Diff: %li\n", endTime.tv_sec * (int)1e6 + endTime.tv_usec - (startTime.tv_sec * (int)1e6 + startTime.tv_usec));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement