Module Name:    src
Committed By:   christos
Date:           Fri Mar 26 21:33:28 UTC 2010

Modified Files:
        src/external/cddl/osnet/sys/sys: time.h

Log Message:
deal with missing CLOCK_REALTIME


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/sys/sys/time.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/sys/sys/time.h
diff -u src/external/cddl/osnet/sys/sys/time.h:1.3 src/external/cddl/osnet/sys/sys/time.h:1.4
--- src/external/cddl/osnet/sys/sys/time.h:1.3	Sat Feb 20 20:46:36 2010
+++ src/external/cddl/osnet/sys/sys/time.h	Fri Mar 26 17:33:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: time.h,v 1.3 2010/02/21 01:46:36 darran Exp $	*/
+/*	$NetBSD: time.h,v 1.4 2010/03/26 21:33:28 christos Exp $	*/
 
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek <p...@freebsd.org>
@@ -67,9 +67,15 @@
 #else
 
 static __inline hrtime_t gethrtime(void) {
+#ifdef CLOCK_REALTIME
 	struct timespec ts;
 	clock_gettime(CLOCK_REALTIME,&ts);
 	return (((u_int64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec);
+#else
+	struct timeval tv;
+	gettimeofday(&tv, NULL);
+	return (((u_int64_t) tv.tv_sec) * MICROSEC + tv.tv_usec) * 1000;
+#endif
 }
 
 #endif	/* _KERNEL */

Reply via email to