Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern switch to nanotime() for 100ns resolution
details: https://anonhg.NetBSD.org/src/rev/a10a8b72620d
branches: trunk
changeset: 754581:a10a8b72620d
user: kardel <kardel%NetBSD.org@localhost>
date: Tue May 04 19:23:56 2010 +0000
description:
switch to nanotime() for 100ns resolution
diffstat:
sys/kern/kern_uuid.c | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diffs (42 lines):
diff -r 82afecd919fc -r a10a8b72620d sys/kern/kern_uuid.c
--- a/sys/kern/kern_uuid.c Tue May 04 19:16:22 2010 +0000
+++ b/sys/kern/kern_uuid.c Tue May 04 19:23:56 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_uuid.c,v 1.16 2008/11/18 14:01:03 joerg Exp $ */
+/* $NetBSD: kern_uuid.c,v 1.17 2010/05/04 19:23:56 kardel Exp $ */
/*
* Copyright (c) 2002 Marcel Moolenaar
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_uuid.c,v 1.16 2008/11/18 14:01:03 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_uuid.c,v 1.17 2010/05/04 19:23:56 kardel Exp $");
#include <sys/param.h>
#include <sys/endian.h>
@@ -136,19 +136,15 @@
* the Unix time since 00:00:00.00, January 1, 1970 to the date of the
* Gregorian reform to the Christian calendar.
*/
-/*
- * At present, NetBSD has no timespec source, only timeval sources. So,
- * we use timeval.
- */
static uint64_t
uuid_time(void)
{
- struct timeval tv;
+ struct timespec tsp;
uint64_t xtime = 0x01B21DD213814000LL;
- microtime(&tv);
- xtime += (uint64_t)tv.tv_sec * 10000000LL;
- xtime += (uint64_t)(10 * tv.tv_usec);
+ nanotime(&tsp);
+ xtime += (uint64_t)tsp.tv_sec * 10000000LL;
+ xtime += (uint64_t)(tsp.tv_nsec / 100);
return (xtime & ((1LL << 60) - 1LL));
}
Home |
Main Index |
Thread Index |
Old Index