timetc.h (34961) | timetc.h (35029) |
---|---|
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.21 1998/03/26 20:53:36 phk Exp $ | 34 * $Id: time.h,v 1.22 1998/03/30 09:55:35 phk Exp $ |
35 */ 36 37#ifndef _SYS_TIME_H_ 38#define _SYS_TIME_H_ 39 40#include <sys/types.h> 41 42/* --- 101 unchanged lines hidden (view full) --- 144 int32_t adjustment; 145 u_int32_t scale_micro; 146 u_int32_t scale_nano_i; 147 u_int32_t scale_nano_f; 148 u_int64_t offset_count; 149 u_int32_t offset_sec; 150 u_int32_t offset_micro; 151 u_int64_t offset_nano; | 35 */ 36 37#ifndef _SYS_TIME_H_ 38#define _SYS_TIME_H_ 39 40#include <sys/types.h> 41 42/* --- 101 unchanged lines hidden (view full) --- 144 int32_t adjustment; 145 u_int32_t scale_micro; 146 u_int32_t scale_nano_i; 147 u_int32_t scale_nano_f; 148 u_int64_t offset_count; 149 u_int32_t offset_sec; 150 u_int32_t offset_micro; 151 u_int64_t offset_nano; |
152 struct timeval microtime; 153 struct timespec nanotime; |
|
152 struct timecounter *other; 153 struct timecounter *tweak; 154}; 155 | 154 struct timecounter *other; 155 struct timecounter *tweak; 156}; 157 |
158#ifdef KERNEL 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)) 166#define timespecadd(vvp, uvp) \ 167 do { \ 168 (vvp)->tv_sec += (uvp)->tv_sec; \ 169 (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) 175#define timespecsub(vvp, uvp) \ 176 do { \ 177 (vvp)->tv_sec -= (uvp)->tv_sec; \ 178 (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) |
|
156/* Operations on timevals. */ | 184/* Operations on timevals. */ |
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)) 189#endif /* KERNEL */ 190 191/* Operations on timevals. */ |
|
157#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 158#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) 159#define timercmp(tvp, uvp, cmp) \ 160 (((tvp)->tv_sec == (uvp)->tv_sec) ? \ 161 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ 162 ((tvp)->tv_sec cmp (uvp)->tv_sec)) 163#ifndef KERNEL /* use timevaladd/timevalsub in kernel */ 164/* NetBSD/OpenBSD compatable interfaces */ --- 54 unchanged lines hidden (view full) --- 219#define TIMER_ABSTIME 0x1 /* absolute timer */ 220#endif 221 222#ifdef KERNEL 223extern struct timecounter *timecounter; 224extern time_t time_second; 225 226void forward_timecounter __P((void)); | 192#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 193#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) 194#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)) 198#ifndef KERNEL /* use timevaladd/timevalsub in kernel */ 199/* NetBSD/OpenBSD compatable interfaces */ --- 54 unchanged lines hidden (view full) --- 254#define TIMER_ABSTIME 0x1 /* absolute timer */ 255#endif 256 257#ifdef KERNEL 258extern struct timecounter *timecounter; 259extern time_t time_second; 260 261void forward_timecounter __P((void)); |
262void getmicroruntime __P((struct timeval *tv)); |
|
227void getmicrotime __P((struct timeval *tv)); | 263void getmicrotime __P((struct timeval *tv)); |
264void getnanoruntime __P((struct timespec *tv)); |
|
228void getnanotime __P((struct timespec *tv)); 229void init_timecounter __P((struct timecounter *tc)); | 265void getnanotime __P((struct timespec *tv)); 266void init_timecounter __P((struct timecounter *tc)); |
230int itimerfix __P((struct timeval *tv)); | |
231int itimerdecr __P((struct itimerval *itp, int usec)); | 267int itimerdecr __P((struct itimerval *itp, int usec)); |
268int itimerfix __P((struct timeval *tv)); 269void microruntime __P((struct timeval *tv)); |
|
232void microtime __P((struct timeval *tv)); | 270void microtime __P((struct timeval *tv)); |
271void nanoruntime __P((struct timespec *ts)); |
|
233void nanotime __P((struct timespec *ts)); | 272void nanotime __P((struct timespec *ts)); |
234void second_overflow __P((u_int32_t *psec)); | |
235void set_timecounter __P((struct timespec *ts)); 236void timevaladd __P((struct timeval *, struct timeval *)); 237void timevalsub __P((struct timeval *, struct timeval *)); 238int tvtohz __P((struct timeval *)); 239#else /* !KERNEL */ 240#include <time.h> 241 242#include <sys/cdefs.h> --- 13 unchanged lines hidden --- | 273void set_timecounter __P((struct timespec *ts)); 274void timevaladd __P((struct timeval *, struct timeval *)); 275void timevalsub __P((struct timeval *, struct timeval *)); 276int tvtohz __P((struct timeval *)); 277#else /* !KERNEL */ 278#include <time.h> 279 280#include <sys/cdefs.h> --- 13 unchanged lines hidden --- |