xref: /original-bsd/sys/sys/time.h (revision 9c5e301d)
1 /*
2  * Copyright (c) 1982, 1986 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)time.h	7.6 (Berkeley) 02/22/91
8  */
9 
10 #ifndef _SYS_TIME_H_
11 #define _SYS_TIME_H_
12 
13 /*
14  * Structure returned by gettimeofday(2) system call,
15  * and used in other calls.
16  */
17 struct timeval {
18 	long	tv_sec;		/* seconds */
19 	long	tv_usec;	/* and microseconds */
20 };
21 
22 struct timezone {
23 	int	tz_minuteswest;	/* minutes west of Greenwich */
24 	int	tz_dsttime;	/* type of dst correction */
25 };
26 #define	DST_NONE	0	/* not on dst */
27 #define	DST_USA		1	/* USA style dst */
28 #define	DST_AUST	2	/* Australian style dst */
29 #define	DST_WET		3	/* Western European dst */
30 #define	DST_MET		4	/* Middle European dst */
31 #define	DST_EET		5	/* Eastern European dst */
32 #define	DST_CAN		6	/* Canada */
33 
34 /*
35  * Operations on timevals.
36  *
37  * NB: timercmp does not work for >= or <=.
38  */
39 #define	timerisset(tvp)		((tvp)->tv_sec || (tvp)->tv_usec)
40 #define	timercmp(tvp, uvp, cmp)	\
41 	((tvp)->tv_sec cmp (uvp)->tv_sec || \
42 	 (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
43 #define	timerclear(tvp)		(tvp)->tv_sec = (tvp)->tv_usec = 0
44 
45 /*
46  * Names of the interval timers, and structure
47  * defining a timer setting.
48  */
49 #define	ITIMER_REAL	0
50 #define	ITIMER_VIRTUAL	1
51 #define	ITIMER_PROF	2
52 
53 struct	itimerval {
54 	struct	timeval it_interval;	/* timer interval */
55 	struct	timeval it_value;	/* current value */
56 };
57 
58 #ifndef KERNEL
59 #include <time.h>
60 
61 #ifndef _POSIX_SOURCE
62 #include <sys/cdefs.h>
63 
64 __BEGIN_DECLS
65 int	adjtime __P((const struct timeval *, struct timeval *));
66 int	getitimer __P((int, struct itimerval *));
67 int	gettimeofday __P((struct timeval *, struct timezone *));
68 int	setitimer __P((int, const struct itimerval *, struct itimerval *));
69 int	settimeofday __P((const struct timeval *, const struct timezone *));
70 int	utimes __P((const char *, const struct timeval *));
71 __END_DECLS
72 #endif /* !POSIX */
73 
74 #endif /* !KERNEL */
75 
76 #endif /* !_SYS_TIME_H_ */
77