xref: /original-bsd/sys/sys/time.h (revision 9087ff44)
1 /*
2  * Copyright (c) 1982 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)time.h	6.4 (Berkeley) 06/24/85
7  */
8 
9 /*
10  * Structure returned by gettimeofday(2) system call,
11  * and used in other calls.
12  */
13 struct timeval {
14 	long	tv_sec;		/* seconds */
15 	long	tv_usec;	/* and microseconds */
16 };
17 
18 struct timezone {
19 	int	tz_minuteswest;	/* minutes west of Greenwich */
20 	int	tz_dsttime;	/* type of dst correction */
21 };
22 #define	DST_NONE	0	/* not on dst */
23 #define	DST_USA		1	/* USA style dst */
24 #define	DST_AUST	2	/* Australian style dst */
25 #define	DST_WET		3	/* Western European dst */
26 #define	DST_MET		4	/* Middle European dst */
27 #define	DST_EET		5	/* Eastern European dst */
28 #define	DST_CAN		6	/* Canada */
29 
30 /*
31  * Operations on timevals.
32  *
33  * NB: timercmp does not work for >= or <=.
34  */
35 #define	timerisset(tvp)		((tvp)->tv_sec || (tvp)->tv_usec)
36 #define	timercmp(tvp, uvp, cmp)	\
37 	((tvp)->tv_sec cmp (uvp)->tv_sec || \
38 	 (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
39 #define	timerclear(tvp)		(tvp)->tv_sec = (tvp)->tv_usec = 0
40 
41 /*
42  * Names of the interval timers, and structure
43  * defining a timer setting.
44  */
45 #define	ITIMER_REAL	0
46 #define	ITIMER_VIRTUAL	1
47 #define	ITIMER_PROF	2
48 
49 struct	itimerval {
50 	struct	timeval it_interval;	/* timer interval */
51 	struct	timeval it_value;	/* current value */
52 };
53 
54 #ifndef KERNEL
55 #include <time.h>
56 #endif
57