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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
hdr time
lib clock_settime,gettimeofday,settimeofday,stime,utimes
lib nanosleep,usleep
lib utimensat -D_ATFILE_SOURCE sys/stat.h
if ! mem timeval.tv_sec sys/time.h {
struct timeval
{
time_t tv_sec;
time_t tv_usec;
};
}
endif
lib clock_gettime execute{
#include <time.h>
main()
{
struct timespec tv;
return clock_gettime(CLOCK_REALTIME, &tv) != 0;
}
}end
lib utimets link{
#include <time.h>
#include <sys/time.h>
static struct timespec tv;
main()
{
return utimets(".", &tv) != 0;
}
}end
tst - -DN=1 - -DN=2 - -DN=3 - -DN=4 output{
#include <sys/types.h>
#include <sys/time.h>
int
main()
{
struct timeval tv;
#if N == 1
struct timezone tz;
if (gettimeofday(&tv, (struct timezone*)0) < 0)
return 1;
printf("#define tmgettimeofday(p) gettimeofday(p,(struct timezone*)0)\n");
#if _lib_settimeofday
printf("#define tmsettimeofday(p) settimeofday(p,(struct timezone*)0)\n");
#endif
#endif
#if N == 2
if (gettimeofday(&tv, (void*)0) < 0)
return 1;
printf("#define tmgettimeofday(p) gettimeofday(p,(void*)0)\n");
#if _lib_settimeofday
printf("#define tmsettimeofday(p) gettimeofday(p,(void*)0)\n");
#endif
#endif
#if N == 3
if (gettimeofday(&tv) < 0)
return 1;
printf("#define tmgettimeofday(p) gettimeofday(p)\n");
#if _lib_settimeofday
printf("#define tmsettimeofday(p) settimeofday(p)\n");
#endif
#endif
return 0;
}
}end
|