[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1161435445.3054.112.camel@dyn-9-152-230-71.boeblingen.de.ibm.com>
Date: Sat, 21 Oct 2006 14:57:25 +0200
From: Martin Peschke <mp3@...ibm.com>
To: Andrew Morton <akpm@...l.org>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [Patch 1/5] I/O statistics through request queues: timeval_to_us()
The next patch requires a timeval-to-microseconds conversion.
Introducing a helper function (and fixing a comment).
Signed-off-by: Martin Peschke <mp3@...ibm.com>
---
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists