Module Name:    src
Committed By:   riastradh
Date:           Wed Jul 24 02:31:08 UTC 2013

Modified Files:
        src/sys/external/bsd/drm2/include/linux [riastradh-drm2]: ktime.h

Log Message:
Add timespec_to_ns and timeval_to_ns to <linux/ktime.h>.

Not quite the right place, but this'll do for now.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 \
    src/sys/external/bsd/drm2/include/linux/ktime.h

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

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/ktime.h
diff -u src/sys/external/bsd/drm2/include/linux/ktime.h:1.1.2.1 src/sys/external/bsd/drm2/include/linux/ktime.h:1.1.2.2
--- src/sys/external/bsd/drm2/include/linux/ktime.h:1.1.2.1	Wed Jul 24 02:29:27 2013
+++ src/sys/external/bsd/drm2/include/linux/ktime.h	Wed Jul 24 02:31:08 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ktime.h,v 1.1.2.1 2013/07/24 02:29:27 riastradh Exp $	*/
+/*	$NetBSD: ktime.h,v 1.1.2.2 2013/07/24 02:31:08 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -79,6 +79,18 @@ ktime_sub_ns(ktime_t a, int64_t nsec)
 	return ns_to_ktime(ktime_to_ns(a) - nsec);
 }
 
+static inline int64_t
+timespec_to_ns(struct timespec *t)
+{
+	return (t->tv_sec * 1000000000ul) + t->tv_nsec;
+}
+
+static inline int64_t
+timeval_to_ns(struct timeval *tv)
+{
+	return (tv->tv_sec * 1000000000ul) + (tv->tv_usec * 1000ul);
+}
+
 static inline struct timespec
 ns_to_timespec(int64_t nsec)
 {

Reply via email to