Deleted Added
full compact
time.h (32052) time.h (33690)
1/*
2 * Copyright (c) 1982, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)time.h 8.5 (Berkeley) 5/4/95
1/*
2 * Copyright (c) 1982, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)time.h 8.5 (Berkeley) 5/4/95
34 * $Id: time.h,v 1.15 1997/06/24 18:21:09 jhay Exp $
34 * $Id: time.h,v 1.16 1997/12/28 13:36:09 phk Exp $
35 */
36
37#ifndef _SYS_TIME_H_
38#define _SYS_TIME_H_
39
40#include <sys/types.h>
41
42/*

--- 29 unchanged lines hidden (view full) ---

72#define DST_NONE 0 /* not on dst */
73#define DST_USA 1 /* USA style dst */
74#define DST_AUST 2 /* Australian style dst */
75#define DST_WET 3 /* Western European dst */
76#define DST_MET 4 /* Middle European dst */
77#define DST_EET 5 /* Eastern European dst */
78#define DST_CAN 6 /* Canada */
79
35 */
36
37#ifndef _SYS_TIME_H_
38#define _SYS_TIME_H_
39
40#include <sys/types.h>
41
42/*

--- 29 unchanged lines hidden (view full) ---

72#define DST_NONE 0 /* not on dst */
73#define DST_USA 1 /* USA style dst */
74#define DST_AUST 2 /* Australian style dst */
75#define DST_WET 3 /* Western European dst */
76#define DST_MET 4 /* Middle European dst */
77#define DST_EET 5 /* Eastern European dst */
78#define DST_CAN 6 /* Canada */
79
80/*
81 * Structure used to interface to the machine dependent hardware
82 * support for timekeeping.
83 *
84 * A timecounter is a binary counter which has two simple properties:
85 * * it runs at a fixed frequency.
86 * * must not roll over in less than (1+epsilon)/HZ
87 *
88 * get_timecount reads the counter.
89 *
90 * get_timedelta returns difference between the counter now and offset_count
91 *
92 * counter_mask removes unimplemented bits from the count value
93 *
94 * frequency should be obvious
95 *
96 * name is a short mnemonic name for this counter.
97 *
98 * cost is a measure of how long time it takes to read the counter.
99 *
100 * adjustment [PPM << 16] which means that the smallest unit of correction
101 * you can apply amounts to 481.5 usec/year.
102 *
103 * scale_micro [2^32 * usec/tick]
104 *
105 * scale_nano_i [ns/tick]
106 *
107 * scale_nano_f [(ns/2^32)/tick]
108 *
109 * offset_count is the contents of the counter which corresponds to the
110 * rest of the offset_* values
111 *
112 * offset_sec [s]
113 * offset_micro [usec]
114 * offset_nano [ns/2^32] is misnamed, the real unit is .23283064365...
115 * attoseconds (10E-18) and before you ask: yes, they are in fact
116 * called attoseconds, it comes from "atten" for 18 in Danish/Swedish.
117 */
118
119struct timecounter;
120typedef u_int timecounter_get_t __P((struct timecounter *));
121typedef u_int64_t timecounter_delta_t __P((void));
122
123struct timecounter {
124 /* These fields must be initialized by the driver */
125 timecounter_get_t *get_timedelta;
126 timecounter_delta_t *get_timecount;
127 u_int64_t counter_mask;
128 u_int32_t frequency;
129 char *name;
130 /* These fields will be managed by the generic code */
131 int cost;
132 int32_t adjustment;
133 u_int32_t scale_micro;
134 u_int32_t scale_nano_i;
135 u_int32_t scale_nano_f;
136 u_int64_t offset_count;
137 u_int32_t offset_sec;
138 u_int32_t offset_micro;
139 u_int64_t offset_nano;
140 struct timecounter *other;
141 struct timecounter *tweak;
142};
143
80/* Operations on timevals. */
81#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
82#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
83#define timercmp(tvp, uvp, cmp) \
84 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
85 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
86 ((tvp)->tv_sec cmp (uvp)->tv_sec))
87#ifndef KERNEL /* use timevaladd/timevalsub in kernel */

--- 45 unchanged lines hidden (view full) ---

133#define CLOCK_REALTIME 0
134#define CLOCK_VIRTUAL 1
135#define CLOCK_PROF 2
136
137#define TIMER_RELTIME 0x0 /* relative timer */
138#define TIMER_ABSTIME 0x1 /* absolute timer */
139
140#ifdef KERNEL
144/* Operations on timevals. */
145#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
146#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
147#define timercmp(tvp, uvp, cmp) \
148 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
149 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
150 ((tvp)->tv_sec cmp (uvp)->tv_sec))
151#ifndef KERNEL /* use timevaladd/timevalsub in kernel */

--- 45 unchanged lines hidden (view full) ---

197#define CLOCK_REALTIME 0
198#define CLOCK_VIRTUAL 1
199#define CLOCK_PROF 2
200
201#define TIMER_RELTIME 0x0 /* relative timer */
202#define TIMER_ABSTIME 0x1 /* absolute timer */
203
204#ifdef KERNEL
205extern struct timecounter *timecounter;
206
207void forward_timecounter __P((void));
141void gettime __P((struct timeval *tv));
208void gettime __P((struct timeval *tv));
209void init_timecounter __P((struct timecounter *));
142int itimerfix __P((struct timeval *tv));
143int itimerdecr __P((struct itimerval *itp, int usec));
210int itimerfix __P((struct timeval *tv));
211int itimerdecr __P((struct itimerval *itp, int usec));
144void timevaladd __P((struct timeval *, struct timeval *));
145void timevalsub __P((struct timeval *, struct timeval *));
146void microtime __P((struct timeval *tv));
147void nanotime __P((struct timespec *ts));
212void microtime __P((struct timeval *tv));
213void nanotime __P((struct timespec *ts));
214void second_overflow __P((u_int32_t *psec));
215void set_timecounter __P((struct timespec *));
216void timevaladd __P((struct timeval *, struct timeval *));
217void timevalsub __P((struct timeval *, struct timeval *));
148#else /* !KERNEL */
149#include <time.h>
150
151#ifndef _POSIX_SOURCE
152#include <sys/cdefs.h>
153
154__BEGIN_DECLS
155int adjtime __P((const struct timeval *, struct timeval *));
156int getitimer __P((int, struct itimerval *));
157int gettimeofday __P((struct timeval *, struct timezone *));
158int setitimer __P((int, const struct itimerval *, struct itimerval *));
159int settimeofday __P((const struct timeval *, const struct timezone *));
160int utimes __P((const char *, const struct timeval *));
161__END_DECLS
162#endif /* !POSIX */
163
164#endif /* !KERNEL */
165
166#endif /* !_SYS_TIME_H_ */
218#else /* !KERNEL */
219#include <time.h>
220
221#ifndef _POSIX_SOURCE
222#include <sys/cdefs.h>
223
224__BEGIN_DECLS
225int adjtime __P((const struct timeval *, struct timeval *));
226int getitimer __P((int, struct itimerval *));
227int gettimeofday __P((struct timeval *, struct timezone *));
228int setitimer __P((int, const struct itimerval *, struct itimerval *));
229int settimeofday __P((const struct timeval *, const struct timezone *));
230int utimes __P((const char *, const struct timeval *));
231__END_DECLS
232#endif /* !POSIX */
233
234#endif /* !KERNEL */
235
236#endif /* !_SYS_TIME_H_ */