From 4f083821e44846fd5366d4f7c322e1807740fb7b Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 26 Mar 2010 21:33:28 +0000 Subject: [PATCH] deal with missing CLOCK_REALTIME --- external/cddl/osnet/sys/sys/time.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/external/cddl/osnet/sys/sys/time.h b/external/cddl/osnet/sys/sys/time.h index be40451db6f0..0efbff1a0cf1 100644 --- a/external/cddl/osnet/sys/sys/time.h +++ b/external/cddl/osnet/sys/sys/time.h @@ -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 @@ -67,9 +67,15 @@ gethrtime(void) { #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 */