Advertisement
cetex

Untitled

May 30th, 2022
656
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include <sys/time.h>
  2. #include <stdio.h>
  3.  
  4.  
  5. int main () {
  6.   struct timeval startTime;
  7.   gettimeofday(&startTime, NULL);
  8.   struct timeval endTime;
  9.   gettimeofday(&endTime, NULL);
  10.   printf("Start time: %li\n", startTime.tv_sec * (int)1e6 + startTime.tv_usec);
  11.   printf("End time: %li\n", endTime.tv_sec * (int)1e6 + endTime.tv_usec);
  12.   printf("Diff: %li\n", endTime.tv_sec * (int)1e6 + endTime.tv_usec - (startTime.tv_sec * (int)1e6 + startTime.tv_usec));
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement