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