summaryrefslogtreecommitdiffstats
path: root/sys/cddl
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>2007-11-28 21:44:17 +0000
committerjb <jb@FreeBSD.org>2007-11-28 21:44:17 +0000
commit68f7a0964d11f704113851f26d30c85384689474 (patch)
treeb5d6a5ab1fabe7022d140e32453a5bc71fc22a23 /sys/cddl
parent817ac88e3e4a782de0f5900bac3130ed0f307cce (diff)
downloadFreeBSD-src-68f7a0964d11f704113851f26d30c85384689474.zip
FreeBSD-src-68f7a0964d11f704113851f26d30c85384689474.tar.gz
Rename the definition of lbolt to LBOLT to avoid a clash with a global
variable in FreeBSD. Until now lbolt in sys/proc.h has been #ifdef'ed out based on _SOLARIS_C_SOURCE, but that is going away now.
Diffstat (limited to 'sys/cddl')
-rw-r--r--sys/cddl/compat/opensolaris/sys/time.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/cddl/compat/opensolaris/sys/time.h b/sys/cddl/compat/opensolaris/sys/time.h
index 94d24a5..770b251 100644
--- a/sys/cddl/compat/opensolaris/sys/time.h
+++ b/sys/cddl/compat/opensolaris/sys/time.h
@@ -31,9 +31,17 @@
#include_next <sys/time.h>
+#define SEC 1
+#define MILLISEC 1000
+#define MICROSEC 1000000
+#define NANOSEC 1000000000
+
+typedef longlong_t hrtime_t;
+
+#define LBOLT ((gethrtime() * hz) / NANOSEC)
+
#ifdef _KERNEL
-#define lbolt ((gethrtime() * hz) / NANOSEC)
-#define lbolt64 (int64_t)(lbolt)
+#define lbolt64 (int64_t)(LBOLT)
static __inline hrtime_t
gethrtime(void) {
@@ -53,6 +61,15 @@ gethrtime(void) {
#define gethrestime_sec() (time_second)
#define gethrestime(ts) getnanotime(ts)
+#else
+
+static __inline hrtime_t gethrtime(void) {
+ struct timespec ts;
+ clock_gettime(CLOCK_UPTIME,&ts);
+ return (((u_int64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec);
+}
+
+
#endif /* _KERNEL */
#endif /* !_OPENSOLARIS_SYS_TIME_H_ */
OpenPOWER on IntegriCloud