Add a #define for nanouptime() in the !__HAVE_TIMECOUNTERS case.
This commit is contained in:
parent
1c85a3efd8
commit
88e6c5604d
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: kern_time.c,v 1.120 2007/05/13 10:34:25 dsl Exp $ */
|
/* $NetBSD: kern_time.c,v 1.121 2007/05/13 10:58:51 dsl Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2000, 2004, 2005 The NetBSD Foundation, Inc.
|
* Copyright (c) 2000, 2004, 2005 The NetBSD Foundation, Inc.
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.120 2007/05/13 10:34:25 dsl Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.121 2007/05/13 10:58:51 dsl Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/resourcevar.h>
|
#include <sys/resourcevar.h>
|
||||||
|
@ -215,18 +215,7 @@ sys_clock_gettime(struct lwp *l, void *v, register_t *retval)
|
||||||
nanotime(&ats);
|
nanotime(&ats);
|
||||||
break;
|
break;
|
||||||
case CLOCK_MONOTONIC:
|
case CLOCK_MONOTONIC:
|
||||||
#ifdef __HAVE_TIMECOUNTER
|
|
||||||
nanouptime(&ats);
|
nanouptime(&ats);
|
||||||
#else /* !__HAVE_TIMECOUNTER */
|
|
||||||
{
|
|
||||||
int s;
|
|
||||||
|
|
||||||
/* XXX "hz" granularity */
|
|
||||||
s = splclock();
|
|
||||||
TIMEVAL_TO_TIMESPEC(&mono_time,&ats);
|
|
||||||
splx(s);
|
|
||||||
}
|
|
||||||
#endif /* !__HAVE_TIMECOUNTER */
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: timevar.h,v 1.9 2007/05/13 10:34:25 dsl Exp $ */
|
/* $NetBSD: timevar.h,v 1.10 2007/05/13 10:58:50 dsl Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005 The NetBSD Foundation.
|
* Copyright (c) 2005 The NetBSD Foundation.
|
||||||
|
@ -206,6 +206,9 @@ extern volatile struct timeval time;
|
||||||
#define time_second time.tv_sec
|
#define time_second time.tv_sec
|
||||||
#define time_uptime mono_time.tv_sec
|
#define time_uptime mono_time.tv_sec
|
||||||
#define tc_getfrequency() hz
|
#define tc_getfrequency() hz
|
||||||
|
#define nanouptime(ats) do { int _s = splclock(); \
|
||||||
|
TIMEVAL_TO_TIMESPEC(&mono_time, ats); \
|
||||||
|
splx(_s); } while (0)
|
||||||
#endif /* !__HAVE_TIMECOUNTER */
|
#endif /* !__HAVE_TIMECOUNTER */
|
||||||
|
|
||||||
#endif /* !_SYS_TIMEVAR_H_ */
|
#endif /* !_SYS_TIMEVAR_H_ */
|
||||||
|
|
Loading…
Reference in New Issue