Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Adjust code that tries to prevent cc_microtime() fr...
details: https://anonhg.NetBSD.org/src/rev/f5548995e159
branches: trunk
changeset: 566730:f5548995e159
user: nathanw <nathanw%NetBSD.org@localhost>
date: Tue May 18 16:09:07 2004 +0000
description:
Adjust code that tries to prevent cc_microtime() from going backwards
so that it doesn't fire when called twice in the same microsecond,
which can lead to large error accumulation.
Appears to fix "repeated gettimeofday() goes backwards" on a fast
alpha and i386 box.
diffstat:
sys/kern/kern_microtime.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r e23ce6dd9d3c -r f5548995e159 sys/kern/kern_microtime.c
--- a/sys/kern/kern_microtime.c Tue May 18 16:08:33 2004 +0000
+++ b/sys/kern/kern_microtime.c Tue May 18 16:09:07 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_microtime.c,v 1.4 2003/06/28 15:02:24 simonb Exp $ */
+/* $NetBSD: kern_microtime.c,v 1.5 2004/05/18 16:09:07 nathanw Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: kern_microtime.c,v 1.4 2003/06/28 15:02:24 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_microtime.c,v 1.5 2004/05/18 16:09:07 nathanw Exp $");
#include "opt_multiprocessor.h"
@@ -137,7 +137,7 @@
usec += 1000000;
sec--;
}
- if (sec == 0) {
+ if (sec == 0 && usec > 0) {
t.tv_usec += usec + 1;
if (t.tv_usec >= 1000000) {
t.tv_usec -= 1000000;
Home |
Main Index |
Thread Index |
Old Index