kern_time.c (12381) | kern_time.c (12819) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 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 * @(#)kern_time.c 8.1 (Berkeley) 6/10/93 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 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 * @(#)kern_time.c 8.1 (Berkeley) 6/10/93 |
34 * $Id: kern_time.c,v 1.11 1995/11/12 06:43:02 bde Exp $ | 34 * $Id: kern_time.c,v 1.12 1995/11/19 00:59:22 bde Exp $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/sysproto.h> 39#include <sys/resourcevar.h> 40#include <sys/signalvar.h> 41#include <sys/kernel.h> 42#include <sys/systm.h> --- 88 unchanged lines hidden (view full) --- 131 if (uap->tzp) 132 tz = atz; 133 return (0); 134} 135 136extern int tickadj; /* "standard" clock skew, us./tick */ 137int tickdelta; /* current clock skew, us. per tick */ 138long timedelta; /* unapplied time correction, us. */ | 35 */ 36 37#include <sys/param.h> 38#include <sys/sysproto.h> 39#include <sys/resourcevar.h> 40#include <sys/signalvar.h> 41#include <sys/kernel.h> 42#include <sys/systm.h> --- 88 unchanged lines hidden (view full) --- 131 if (uap->tzp) 132 tz = atz; 133 return (0); 134} 135 136extern int tickadj; /* "standard" clock skew, us./tick */ 137int tickdelta; /* current clock skew, us. per tick */ 138long timedelta; /* unapplied time correction, us. */ |
139long bigadj = 1000000; /* use 10x skew above bigadj us. */ | 139static long bigadj = 1000000; /* use 10x skew above bigadj us. */ |
140 141#ifndef _SYS_SYSPROTO_H_ 142struct adjtime_args { 143 struct timeval *delta; 144 struct timeval *olddelta; 145}; 146#endif 147/* ARGSUSED */ --- 278 unchanged lines hidden (view full) --- 426 struct timeval *t1, *t2; 427{ 428 429 t1->tv_sec -= t2->tv_sec; 430 t1->tv_usec -= t2->tv_usec; 431 timevalfix(t1); 432} 433 | 140 141#ifndef _SYS_SYSPROTO_H_ 142struct adjtime_args { 143 struct timeval *delta; 144 struct timeval *olddelta; 145}; 146#endif 147/* ARGSUSED */ --- 278 unchanged lines hidden (view full) --- 426 struct timeval *t1, *t2; 427{ 428 429 t1->tv_sec -= t2->tv_sec; 430 t1->tv_usec -= t2->tv_usec; 431 timevalfix(t1); 432} 433 |
434void | 434static void |
435timevalfix(t1) 436 struct timeval *t1; 437{ 438 439 if (t1->tv_usec < 0) { 440 t1->tv_sec--; 441 t1->tv_usec += 1000000; 442 } 443 if (t1->tv_usec >= 1000000) { 444 t1->tv_sec++; 445 t1->tv_usec -= 1000000; 446 } 447} | 435timevalfix(t1) 436 struct timeval *t1; 437{ 438 439 if (t1->tv_usec < 0) { 440 t1->tv_sec--; 441 t1->tv_usec += 1000000; 442 } 443 if (t1->tv_usec >= 1000000) { 444 t1->tv_sec++; 445 t1->tv_usec -= 1000000; 446 } 447} |