diff options
author | 2000-07-07 15:37:00 +0000 | |
---|---|---|
committer | 2000-07-07 15:37:00 +0000 | |
commit | b4dd1317551c8bab4718b77b960a702c4bfc61bf (patch) | |
tree | 2fc2cd9d79efca2a96ea2c28518fd33cc44f3bc0 /sys/kern/kern_clock.c | |
parent | If the timeout is not set, don't send a zeroed timeout to select. (diff) | |
download | wireguard-openbsd-b4dd1317551c8bab4718b77b960a702c4bfc61bf.tar.xz wireguard-openbsd-b4dd1317551c8bab4718b77b960a702c4bfc61bf.zip |
Make hzto return 0 for timeouts that should happen now or in the past.
Diffstat (limited to 'sys/kern/kern_clock.c')
-rw-r--r-- | sys/kern/kern_clock.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index c24254237db..125dffef205 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_clock.c,v 1.25 2000/07/06 15:33:31 ho Exp $ */ +/* $OpenBSD: kern_clock.c,v 1.26 2000/07/07 15:37:00 art Exp $ */ /* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */ /*- @@ -697,8 +697,8 @@ int hzto(tv) struct timeval *tv; { - register unsigned long ticks; - register long sec, usec; + unsigned long ticks; + long sec, usec; int s; /* @@ -729,8 +729,8 @@ hzto(tv) sec--; usec += 1000000; } - if (sec < 0) { - ticks = 1; + if (sec < 0 || (sec == 0 && usec <= 0)) { + ticks = 0; } else if (sec <= LONG_MAX / 1000000) ticks = (sec * 1000000 + (unsigned long)usec + (tick - 1)) / tick + 1; |