diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index cf25a467185..72e18458566 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -39,7 +39,7 @@ static volatile int print_tci = 1; * SUCH DAMAGE. * * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 - * $Id: kern_clock.c,v 1.62 1998/03/31 10:47:01 phk Exp $ + * $Id: kern_clock.c,v 1.63 1998/04/04 13:25:11 phk Exp $ */ #include @@ -532,7 +532,7 @@ microtime(struct timeval *tv) ((u_int64_t)tc->get_timedelta(tc) * tc->scale_micro) >> 32; tv->tv_usec += boottime.tv_usec; tv->tv_sec += boottime.tv_sec; - if (tv->tv_usec >= 1000000) { + while (tv->tv_usec >= 1000000) { tv->tv_usec -= 1000000; tv->tv_sec++; } @@ -554,7 +554,7 @@ nanotime(struct timespec *tv) delta += ((u_int64_t)count * tc->scale_nano_i); delta += boottime.tv_usec * 1000; tv->tv_sec += boottime.tv_sec; - if (delta >= 1000000000) { + while (delta >= 1000000000) { delta -= 1000000000; tv->tv_sec++; } diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index cf25a467185..72e18458566 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -39,7 +39,7 @@ static volatile int print_tci = 1; * SUCH DAMAGE. * * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 - * $Id: kern_clock.c,v 1.62 1998/03/31 10:47:01 phk Exp $ + * $Id: kern_clock.c,v 1.63 1998/04/04 13:25:11 phk Exp $ */ #include @@ -532,7 +532,7 @@ microtime(struct timeval *tv) ((u_int64_t)tc->get_timedelta(tc) * tc->scale_micro) >> 32; tv->tv_usec += boottime.tv_usec; tv->tv_sec += boottime.tv_sec; - if (tv->tv_usec >= 1000000) { + while (tv->tv_usec >= 1000000) { tv->tv_usec -= 1000000; tv->tv_sec++; } @@ -554,7 +554,7 @@ nanotime(struct timespec *tv) delta += ((u_int64_t)count * tc->scale_nano_i); delta += boottime.tv_usec * 1000; tv->tv_sec += boottime.tv_sec; - if (delta >= 1000000000) { + while (delta >= 1000000000) { delta -= 1000000000; tv->tv_sec++; } diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 786f67f3fcb..c6407f69125 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_time.c 8.1 (Berkeley) 6/10/93 - * $Id: kern_time.c,v 1.44 1998/03/30 09:50:23 phk Exp $ + * $Id: kern_time.c,v 1.45 1998/04/04 13:25:25 phk Exp $ */ #include @@ -536,12 +536,9 @@ setitimer(p, uap) if (uap->which == ITIMER_REAL) { if (timerisset(&p->p_realtimer.it_value)) untimeout(realitexpire, (caddr_t)p, p->p_ithandle); - if (timerisset(&aitv.it_value)) { - getmicrotime(&ctv); - timevaladd(&aitv.it_value, &ctv); + if (timerisset(&aitv.it_value)) p->p_ithandle = timeout(realitexpire, (caddr_t)p, - hzto(&aitv.it_value)); - } + tvtohz(&aitv.it_value)); p->p_realtimer = aitv; } else p->p_stats->p_timer[uap->which] = aitv;