Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/sys/sys deal with missing CLOCK_REALTIME



details:   https://anonhg.NetBSD.org/src/rev/99c021970a87
branches:  trunk
changeset: 753410:99c021970a87
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Mar 26 21:33:28 2010 +0000

description:
deal with missing CLOCK_REALTIME

diffstat:

 external/cddl/osnet/sys/sys/time.h |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (25 lines):

diff -r 04c0c085df57 -r 99c021970a87 external/cddl/osnet/sys/sys/time.h
--- a/external/cddl/osnet/sys/sys/time.h        Fri Mar 26 21:06:25 2010 +0000
+++ b/external/cddl/osnet/sys/sys/time.h        Fri Mar 26 21:33:28 2010 +0000
@@ -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 <pjd%FreeBSD.org@localhost>
@@ -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 */



Home | Main Index | Thread Index | Old Index