test structure too
[tridge/junkcode.git] / sleeptst.c
1 #include <stdio.h>
2 #include <sys/time.h>
3
4
5 main()
6 {
7 struct timeval tp1;
8 struct timeval tp2;
9 int i;
10
11 for (i=0;i<10;i++)
12   {
13
14     gettimeofday(&tp1,NULL);
15     usleep(1*i);
16     gettimeofday(&tp2,NULL);
17
18     printf("diff=%d\n",
19            (tp2.tv_sec-tp1.tv_sec)*1000000 + (tp2.tv_usec-tp1.tv_usec));
20   }
21 }