diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-06-21 04:43:34 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-06-21 04:43:34 +0000 |
commit | 029cb46788da1108bab08eaec61a22f16131d838 (patch) | |
tree | a9a80b83cccff95df8315384502be3dbb395b09b /sys/arch | |
parent | b1d6462dd2bd74704484a76aad92ca19953dc48b (diff) |
Fix microtime to not lose clocik ticks, gives us among other things, real
ping times on slow links; from mickey
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sh/sh/clock.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/arch/sh/sh/clock.c b/sys/arch/sh/sh/clock.c index 6a9954ff043..15e3ea1b143 100644 --- a/sys/arch/sh/sh/clock.c +++ b/sys/arch/sh/sh/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.3 2006/11/04 02:08:25 mickey Exp $ */ +/* $OpenBSD: clock.c,v 1.4 2007/06/21 04:43:33 miod Exp $ */ /* $NetBSD: clock.c,v 1.32 2006/09/05 11:09:36 uwe Exp $ */ /*- @@ -209,14 +209,15 @@ void microtime(struct timeval *tv) { static struct timeval lasttime; + u_int32_t tcnt0; int s; s = splclock(); *tv = time; + tcnt0 = _reg_read_4(SH_(TCNT0)); splx(s); - tv->tv_usec += ((sh_clock.hz_cnt - _reg_read_4(SH_(TCNT0))) - * 1000000) / sh_clock.tmuclk; + tv->tv_usec += ((sh_clock.hz_cnt - tcnt0) * 1000000) / sh_clock.tmuclk; while (tv->tv_usec >= 1000000) { tv->tv_usec -= 1000000; tv->tv_sec++; |