]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/ktime.h
Merge branch 'upstream-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/linvil...
[linux-2.6-omap-h63xx.git] / include / linux / ktime.h
index 248305bb9a181681e837667a9fa0f005330a3fa0..c762954bda148fa18ab13f6d1f71aab26d2e3441 100644 (file)
@@ -43,7 +43,7 @@
  * plain scalar nanosecond based representation can be selected by the
  * config switch CONFIG_KTIME_SCALAR.
  */
-typedef union {
+union ktime {
        s64     tv64;
 #if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
        struct {
@@ -54,7 +54,9 @@ typedef union {
 # endif
        } tv;
 #endif
-} ktime_t;
+};
+
+typedef union ktime ktime_t;           /* Kill this */
 
 #define KTIME_MAX                      ((s64)~((u64)1 << 63))
 #if (BITS_PER_LONG == 64)
@@ -259,6 +261,12 @@ static inline s64 ktime_to_ns(const ktime_t kt)
 
 #endif
 
+static inline s64 ktime_to_us(const ktime_t kt)
+{
+       struct timeval tv = ktime_to_timeval(kt);
+       return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
+}
+
 /*
  * The resolution of the clocks. The resolution value is returned in
  * the clock_getres() system call to give application programmers an