Deleted Added
full compact
time.h (35029) time.h (35058)
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.22 1998/03/30 09:55:35 phk Exp $
34 * $Id: time.h,v 1.23 1998/04/04 13:26:16 phk Exp $
35 */
36
37#ifndef _SYS_TIME_H_
38#define _SYS_TIME_H_
39
40#include <sys/types.h>
41
42/*

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

151 u_int64_t offset_nano;
152 struct timeval microtime;
153 struct timespec nanotime;
154 struct timecounter *other;
155 struct timecounter *tweak;
156};
157
158#ifdef KERNEL
35 */
36
37#ifndef _SYS_TIME_H_
38#define _SYS_TIME_H_
39
40#include <sys/types.h>
41
42/*

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

151 u_int64_t offset_nano;
152 struct timeval microtime;
153 struct timespec nanotime;
154 struct timecounter *other;
155 struct timecounter *tweak;
156};
157
158#ifdef KERNEL
159
159/* Operations on timespecs */
160#define timespecclear(tvp) (tvp)->tv_sec = (tvp)->tv_nsec = 0
161#define timespecisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec)
162#define timespeccmp(tvp, uvp, cmp) \
163 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
164 ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
165 ((tvp)->tv_sec cmp (uvp)->tv_sec))
160/* Operations on timespecs */
161#define timespecclear(tvp) (tvp)->tv_sec = (tvp)->tv_nsec = 0
162#define timespecisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec)
163#define timespeccmp(tvp, uvp, cmp) \
164 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
165 ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
166 ((tvp)->tv_sec cmp (uvp)->tv_sec))
166#define timespecadd(vvp, uvp) \
167#define timespecadd(vvp, uvp) \
167 do { \
168 do { \
168 (vvp)->tv_sec += (uvp)->tv_sec; \
169 (vvp)->tv_nsec += (uvp)->tv_nsec; \
169 (vvp)->tv_sec += (uvp)->tv_sec; \
170 (vvp)->tv_nsec += (uvp)->tv_nsec; \
170 if ((vvp)->tv_nsec >= 1000000000) { \
171 (vvp)->tv_sec++; \
172 (vvp)->tv_nsec -= 1000000000; \
173 } \
174 } while (0)
171 if ((vvp)->tv_nsec >= 1000000000) { \
172 (vvp)->tv_sec++; \
173 (vvp)->tv_nsec -= 1000000000; \
174 } \
175 } while (0)
175#define timespecsub(vvp, uvp) \
176#define timespecsub(vvp, uvp) \
176 do { \
177 do { \
177 (vvp)->tv_sec -= (uvp)->tv_sec; \
178 (vvp)->tv_nsec -= (uvp)->tv_nsec; \
178 (vvp)->tv_sec -= (uvp)->tv_sec; \
179 (vvp)->tv_nsec -= (uvp)->tv_nsec; \
179 if ((vvp)->tv_nsec < 0) { \
180 (vvp)->tv_sec--; \
181 (vvp)->tv_nsec += 1000000000; \
182 } \
183 } while (0)
180 if ((vvp)->tv_nsec < 0) { \
181 (vvp)->tv_sec--; \
182 (vvp)->tv_nsec += 1000000000; \
183 } \
184 } while (0)
185
184/* Operations on timevals. */
186/* Operations on timevals. */
187
188#define timevalclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
189#define timevalisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
185#define timevalcmp(tvp, uvp, cmp) \
186 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
187 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
188 ((tvp)->tv_sec cmp (uvp)->tv_sec))
190#define timevalcmp(tvp, uvp, cmp) \
191 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
192 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
193 ((tvp)->tv_sec cmp (uvp)->tv_sec))
194
195/* timevaladd and timevalsub are not inlined */
196
189#endif /* KERNEL */
190
197#endif /* KERNEL */
198
191/* Operations on timevals. */
199#ifndef KERNEL /* NetBSD/OpenBSD compatable interfaces */
200
192#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
193#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
201#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
202#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
194#define timercmp(tvp, uvp, cmp) \
203#define timercmp(tvp, uvp, cmp) \
195 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
196 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
197 ((tvp)->tv_sec cmp (uvp)->tv_sec))
204 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
205 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
206 ((tvp)->tv_sec cmp (uvp)->tv_sec))
198#ifndef KERNEL /* use timevaladd/timevalsub in kernel */
199/* NetBSD/OpenBSD compatable interfaces */
200#define timeradd(tvp, uvp, vvp) \
201 do { \
202 (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
203 (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
204 if ((vvp)->tv_usec >= 1000000) { \
205 (vvp)->tv_sec++; \
206 (vvp)->tv_usec -= 1000000; \
207 } \

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

253#ifndef TIMER_ABSTIME
254#define TIMER_ABSTIME 0x1 /* absolute timer */
255#endif
256
257#ifdef KERNEL
258extern struct timecounter *timecounter;
259extern time_t time_second;
260
207#define timeradd(tvp, uvp, vvp) \
208 do { \
209 (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
210 (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
211 if ((vvp)->tv_usec >= 1000000) { \
212 (vvp)->tv_sec++; \
213 (vvp)->tv_usec -= 1000000; \
214 } \

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

260#ifndef TIMER_ABSTIME
261#define TIMER_ABSTIME 0x1 /* absolute timer */
262#endif
263
264#ifdef KERNEL
265extern struct timecounter *timecounter;
266extern time_t time_second;
267
261void forward_timecounter __P((void));
262void getmicroruntime __P((struct timeval *tv));
263void getmicrotime __P((struct timeval *tv));
264void getnanoruntime __P((struct timespec *tv));
265void getnanotime __P((struct timespec *tv));
266void init_timecounter __P((struct timecounter *tc));
267int itimerdecr __P((struct itimerval *itp, int usec));
268int itimerfix __P((struct timeval *tv));
269void microruntime __P((struct timeval *tv));

--- 24 unchanged lines hidden ---
268void getmicroruntime __P((struct timeval *tv));
269void getmicrotime __P((struct timeval *tv));
270void getnanoruntime __P((struct timespec *tv));
271void getnanotime __P((struct timespec *tv));
272void init_timecounter __P((struct timecounter *tc));
273int itimerdecr __P((struct itimerval *itp, int usec));
274int itimerfix __P((struct timeval *tv));
275void microruntime __P((struct timeval *tv));

--- 24 unchanged lines hidden ---