#include #include unsigned int max = 1000000000; int main(void) { struct timeval t1, t2; while(max > 1) { gettimeofday(&t1, NULL); gettimeofday(&t2, NULL); if(t1.tv_sec == t2.tv_sec) { unsigned int diff = t2.tv_usec - t1.tv_usec; if(diff && diff < max) { printf("%d\n", diff); max = diff; } } } }