diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2000-07-07 15:37:01 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2000-07-07 15:37:01 +0000 |
commit | 9a51730a9b75386fb02f14582fcd305864c03258 (patch) | |
tree | 16a07d031bcf4fd16acaf460a647f39547d78931 /sys/kern | |
parent | f5a304e3b09c4d007053fb665ec71188a9523438 (diff) |
Make hzto return 0 for timeouts that should happen now or in the past.
Diffstat (limited to 'sys/kern')
-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; |