Module Name: src
Committed By: kardel
Date: Tue May 4 19:23:56 UTC 2010
Modified Files:
src/sys/kern: kern_uuid.c
Log Message:
switch to nanotime() for 100ns resolution
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/kern/kern_uuid.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_uuid.c
diff -u src/sys/kern/kern_uuid.c:1.16 src/sys/kern/kern_uuid.c:1.17
--- src/sys/kern/kern_uuid.c:1.16 Tue Nov 18 14:01:03 2008
+++ src/sys/kern/kern_uuid.c Tue May 4 19:23:56 2010
@@ -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));
}