Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hp300/hp300 Make sure that microtime(9) returns tim...
details: https://anonhg.NetBSD.org/src/rev/f1ba4ad45067
branches: trunk
changeset: 581070:f1ba4ad45067
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Mon May 23 14:54:13 2005 +0000
description:
Make sure that microtime(9) returns time greater than the previous value
like other ports. This may close port-hp300/10571.
diffstat:
sys/arch/hp300/hp300/clock.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (47 lines):
diff -r a6fe658780b2 -r f1ba4ad45067 sys/arch/hp300/hp300/clock.c
--- a/sys/arch/hp300/hp300/clock.c Mon May 23 13:05:04 2005 +0000
+++ b/sys/arch/hp300/hp300/clock.c Mon May 23 14:54:13 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.31 2004/08/28 19:11:19 thorpej Exp $ */
+/* $NetBSD: clock.c,v 1.32 2005/05/23 14:54:13 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@@ -85,7 +85,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.31 2004/08/28 19:11:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.32 2005/05/23 14:54:13 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -353,6 +353,7 @@
{
volatile struct clkreg *clk;
int s, u, t, u2, s2;
+ static struct timeval lasttime;
/*
* Read registers from slowest-changing to fastest-changing,
@@ -375,12 +376,19 @@
} while (u != u2 || s != s2);
u += (clkint - t) * CLK_RESOLUTION;
- if (u >= 1000000) { /* normalize */
+ while (u >= 1000000) { /* normalize */
+ s++;
+ u -= 1000000;
+ }
+ if (s == lasttime.tv_sec &&
+ u <= lasttime.tv_usec &&
+ (u = lasttime.tv_usec + 1) >= 1000000) {
s++;
u -= 1000000;
}
tvp->tv_sec = s;
tvp->tv_usec = u;
+ lasttime = *tvp;
}
/*
Home |
Main Index |
Thread Index |
Old Index