blob: 5b91172cb3abaaa5dde0224cd89ee6d6ef8b5f04 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <windows.h>
int
main()
{
struct timeval tv;
double t1 = 0.0;
double t2 = 0.0;
if (gettimeofday(&tv, NULL) == 0)
t1 = tv.tv_sec + tv.tv_usec / 1000000.0;
Sleep(3000);
if (gettimeofday(&tv, NULL) == 0)
t2 = tv.tv_sec + tv.tv_usec / 1000000.0;
printf ("3 seconds ? %f\n", t2 - t1);
return EXIT_SUCCESS;
}
|