xref: /original-bsd/sys/sys/time.h (revision bc02331a)
1 /*
2  * Copyright (c) 1982, 1986 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)time.h	7.3 (Berkeley) 08/08/89
18  */
19 
20 #ifndef _TIME_
21 #define _TIME_
22 
23 /*
24  * Structure returned by gettimeofday(2) system call,
25  * and used in other calls.
26  */
27 struct timeval {
28 	long	tv_sec;		/* seconds */
29 	long	tv_usec;	/* and microseconds */
30 };
31 
32 struct timezone {
33 	int	tz_minuteswest;	/* minutes west of Greenwich */
34 	int	tz_dsttime;	/* type of dst correction */
35 };
36 #define	DST_NONE	0	/* not on dst */
37 #define	DST_USA		1	/* USA style dst */
38 #define	DST_AUST	2	/* Australian style dst */
39 #define	DST_WET		3	/* Western European dst */
40 #define	DST_MET		4	/* Middle European dst */
41 #define	DST_EET		5	/* Eastern European dst */
42 #define	DST_CAN		6	/* Canada */
43 
44 /*
45  * Operations on timevals.
46  *
47  * NB: timercmp does not work for >= or <=.
48  */
49 #define	timerisset(tvp)		((tvp)->tv_sec || (tvp)->tv_usec)
50 #define	timercmp(tvp, uvp, cmp)	\
51 	((tvp)->tv_sec cmp (uvp)->tv_sec || \
52 	 (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
53 #define	timerclear(tvp)		(tvp)->tv_sec = (tvp)->tv_usec = 0
54 
55 /*
56  * Names of the interval timers, and structure
57  * defining a timer setting.
58  */
59 #define	ITIMER_REAL	0
60 #define	ITIMER_VIRTUAL	1
61 #define	ITIMER_PROF	2
62 
63 struct	itimerval {
64 	struct	timeval it_interval;	/* timer interval */
65 	struct	timeval it_value;	/* current value */
66 };
67 
68 #ifndef KERNEL
69 #include <time.h>
70 #endif
71 
72 #endif /* _TIME_ */
73