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