provide binuptime etc for !__HAVE_TIMECOUNTER.
This commit is contained in:
parent
7bc26029c9
commit
5ffcee498d
sys
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_clock.c,v 1.114 2007/11/06 00:42:40 ad Exp $ */
|
||||
/* $NetBSD: kern_clock.c,v 1.115 2007/12/22 00:34:38 yamt 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.114 2007/11/06 00:42:40 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.115 2007/12/22 00:34:38 yamt Exp $");
|
||||
|
||||
#include "opt_ntp.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
@ -1377,6 +1377,47 @@ hardpps(struct timeval *tvp, /* time at PPS */
|
||||
#endif /* NTP */
|
||||
|
||||
/* timecounter compat functions */
|
||||
void
|
||||
binuptime(struct bintime *bt)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
microuptime(&tv);
|
||||
timeval2bintime(&tv, bt);
|
||||
}
|
||||
|
||||
void
|
||||
nanouptime(struct timespec *tsp)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
microuptime(&tv);
|
||||
TIMEVAL_TO_TIMESPEC(&mono_time, tsp);
|
||||
}
|
||||
|
||||
void
|
||||
microuptime(struct timeval *tv)
|
||||
{
|
||||
struct timeval t;
|
||||
int s;
|
||||
|
||||
/* microtime + time - mono_time */
|
||||
microtime(&t);
|
||||
s = splclock();
|
||||
timeradd(&t, &time, &t);
|
||||
timersub(&t, &mono_time, &t);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
bintime(struct bintime *bt)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
microtime(&tv);
|
||||
timeval2bintime(&tv, bt);
|
||||
}
|
||||
|
||||
void
|
||||
nanotime(struct timespec *ts)
|
||||
{
|
||||
@ -1388,20 +1429,11 @@ nanotime(struct timespec *ts)
|
||||
|
||||
void
|
||||
getbinuptime(struct bintime *bt)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
microtime(&tv);
|
||||
timeval2bintime(&tv, bt);
|
||||
}
|
||||
|
||||
void
|
||||
nanouptime(struct timespec *tsp)
|
||||
{
|
||||
int s;
|
||||
|
||||
s = splclock();
|
||||
TIMEVAL_TO_TIMESPEC(&mono_time, tsp);
|
||||
timeval2bintime(__UNVOLATILE(&mono_time), bt);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
@ -1425,6 +1457,16 @@ getmicrouptime(struct timeval *tvp)
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
getbintime(struct bintime *bt)
|
||||
{
|
||||
int s;
|
||||
|
||||
s = splclock();
|
||||
timeval2bintime(__UNVOLATILE(&time), bt);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
void
|
||||
getnanotime(struct timespec *tsp)
|
||||
{
|
||||
@ -1450,4 +1492,13 @@ tc_getfrequency(void)
|
||||
{
|
||||
return hz;
|
||||
}
|
||||
|
||||
void
|
||||
tc_setclock(struct timespec *ts)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
TIMESPEC_TO_TIMEVAL(&tv, ts);
|
||||
time = tv;
|
||||
}
|
||||
#endif /* !__HAVE_TIMECOUNTER */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: timevar.h,v 1.18 2007/11/25 00:35:28 elad Exp $ */
|
||||
/* $NetBSD: timevar.h,v 1.19 2007/12/22 00:34:37 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 The NetBSD Foundation.
|
||||
@ -129,7 +129,6 @@ struct ptimers {
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __HAVE_TIMECOUNTER
|
||||
void binuptime(struct bintime *);
|
||||
void nanouptime(struct timespec *);
|
||||
void microuptime(struct timeval *);
|
||||
@ -145,19 +144,6 @@ void getmicrouptime(struct timeval *);
|
||||
void getbintime(struct bintime *);
|
||||
void getnanotime(struct timespec *);
|
||||
void getmicrotime(struct timeval *);
|
||||
#else /* !__HAVE_TIMECOUNTER */
|
||||
/* timecounter compat functions */
|
||||
void microtime(struct timeval *);
|
||||
void nanotime(struct timespec *);
|
||||
|
||||
void nanouptime(struct timespec *);
|
||||
void getbinuptime(struct bintime *);
|
||||
void getnanouptime(struct timespec *);
|
||||
void getmicrouptime(struct timeval *);
|
||||
|
||||
void getnanotime(struct timespec *);
|
||||
void getmicrotime(struct timeval *);
|
||||
#endif /* !__HAVE_TIMECOUNTER */
|
||||
|
||||
/* Other functions */
|
||||
int adjtime1(const struct timeval *, struct timeval *, struct proc *);
|
||||
|
Loading…
x
Reference in New Issue
Block a user