Created
September 13, 2019 12:46
-
-
Save nrdmn/0f2d40d75b0711771d3a27e965ac73e8 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
#include <sys/time.h> | |
#include <stddef.h> | |
#include <stdio.h> | |
#define THRESHOLD 1000 | |
int main() | |
{ | |
struct timeval a; | |
struct timeval b; | |
gettimeofday(&b, NULL); | |
for (;;) { | |
a = b; | |
gettimeofday(&b, NULL); | |
long long int diff = 100000*(b.tv_sec - a.tv_sec) + b.tv_usec - a.tv_usec; | |
if (diff > THRESHOLD) { | |
printf("time warped by %lld us\n", diff); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment