The next patch requires a timeval-to-microseconds conversion.
Introducing a helper function (and fixing a comment).
Signed-off-by: Martin Peschke <[email protected]>
---
time.h | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletion(-)
diff -urp a/include/linux/time.h b/include/linux/time.h
--- a/include/linux/time.h 2006-10-03 16:25:53.000000000 +0200
+++ b/include/linux/time.h 2006-10-06 21:36:08.000000000 +0200
@@ -133,8 +133,20 @@ static inline s64 timespec_to_ns(const s
}
/**
+ * timeval_to_us - Convert timeval to microseconds
+ * @tv: pointer to the timeval variable to be converted
+ *
+ * Returns the scalar nanosecond representation of the timeval
+ * parameter.
+ */
+static inline s64 timeval_to_us(const struct timeval *tv)
+{
+ return ((s64) tv->tv_sec * USEC_PER_SEC) + tv->tv_usec;
+}
+
+/**
* timeval_to_ns - Convert timeval to nanoseconds
- * @ts: pointer to the timeval variable to be converted
+ * @tv: pointer to the timeval variable to be converted
*
* Returns the scalar nanosecond representation of the timeval
* parameter.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]