Actually return the computed uptime in microuptime(). Fixes many

wierd timing issues on non-timecounter ports (tested on sbmips, and
omap ARM by Marty Fouts).

Also move the microtime() inside the splclock() block in the same
function - it may be possible for the "time" variable to be updated
after the call to microtime() but before we use it to calculate the
offset from mono_time.
This commit is contained in:
simonb 2008-01-07 10:28:07 +00:00
parent 7e40665ceb
commit cfde7482cd
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_clock.c,v 1.115 2007/12/22 00:34:38 yamt Exp $ */
/* $NetBSD: kern_clock.c,v 1.116 2008/01/07 10:28:07 simonb Exp $ */
/*-
* Copyright (c) 2000, 2004, 2006, 2007 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.115 2007/12/22 00:34:38 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.116 2008/01/07 10:28:07 simonb Exp $");
#include "opt_ntp.h"
#include "opt_multiprocessor.h"
@ -1402,11 +1402,12 @@ microuptime(struct timeval *tv)
int s;
/* microtime + time - mono_time */
microtime(&t);
s = splclock();
microtime(&t);
timeradd(&t, &time, &t);
timersub(&t, &mono_time, &t);
splx(s);
*tv = t;
}
void