xref: /titanic_51/usr/src/lib/libast/common/features/tvlib (revision 0cd13cbfb4270b840b4bd22ec5f673b2b6a2c02b)
1hdr	time
2lib	clock_settime,gettimeofday,settimeofday,stime,utimes
3lib	nanosleep,usleep
4
5if ! mem timeval.tv_sec sys/time.h {
6	struct timeval
7	{
8		time_t	tv_sec;
9		time_t	tv_usec;
10	};
11}
12endif
13
14lib	clock_gettime execute{
15	#include <time.h>
16	main()
17	{
18		struct timespec	tv;
19		return clock_gettime(CLOCK_REALTIME, &tv) != 0;
20	}
21}end
22
23lib	utimets link{
24	#include <time.h>
25	#include <sys/time.h>
26	static struct timespec	tv;
27	main()
28	{
29		return utimets(".", &tv) != 0;
30	}
31}end
32
33tst	- -DN=1 - -DN=2 - -DN=3 - -DN=4 output{
34	#include <sys/types.h>
35	#include <sys/time.h>
36	int
37	main()
38	{
39		struct timeval	tv;
40#if N == 1
41		struct timezone	tz;
42		if (gettimeofday(&tv, (struct timezone*)0) < 0)
43			return 1;
44		printf("#define tmgettimeofday(p)	gettimeofday(p,(struct timezone*)0)\n");
45#if _lib_settimeofday
46		printf("#define tmsettimeofday(p)	settimeofday(p,(struct timezone*)0)\n");
47#endif
48#endif
49#if N == 2
50		if (gettimeofday(&tv, (void*)0) < 0)
51			return 1;
52		printf("#define tmgettimeofday(p)	gettimeofday(p,(void*)0)\n");
53#if _lib_settimeofday
54		printf("#define tmsettimeofday(p)	gettimeofday(p,(void*)0)\n");
55#endif
56#endif
57#if N == 3
58		if (gettimeofday(&tv) < 0)
59			return 1;
60		printf("#define tmgettimeofday(p)	gettimeofday(p)\n");
61#if _lib_settimeofday
62		printf("#define tmsettimeofday(p)	settimeofday(p)\n");
63#endif
64#endif
65		return 0;
66	}
67}end
68