summaryrefslogtreecommitdiffstats
path: root/include/linux/time64.h
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2014-07-16 21:03:59 +0000
committerJohn Stultz <john.stultz@linaro.org>2014-07-23 10:17:53 -0700
commit49cd6f869984692547c57621bf42697aaa7f5622 (patch)
treef0bb760b91afa73f12f6f90db14b190728c0780b /include/linux/time64.h
parent361a3bf00582469877f8d18ff20f1efa6b781274 (diff)
time: More core infrastructure for timespec64
Helper and conversion functions for timespec64. Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'include/linux/time64.h')
-rw-r--r--include/linux/time64.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/time64.h b/include/linux/time64.h
index e7b499e1cd7..a3831478d9c 100644
--- a/include/linux/time64.h
+++ b/include/linux/time64.h
@@ -33,6 +33,16 @@ struct timespec64 {
#if __BITS_PER_LONG == 64
+static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
+{
+ return ts64;
+}
+
+static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
+{
+ return ts;
+}
+
# define timespec64_equal timespec_equal
# define timespec64_compare timespec_compare
# define set_normalized_timespec64 set_normalized_timespec
@@ -47,6 +57,24 @@ struct timespec64 {
#else
+static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
+{
+ struct timespec ret;
+
+ ret.tv_sec = (time_t)ts64.tv_sec;
+ ret.tv_nsec = ts64.tv_nsec;
+ return ret;
+}
+
+static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
+{
+ struct timespec64 ret;
+
+ ret.tv_sec = ts.tv_sec;
+ ret.tv_nsec = ts.tv_nsec;
+ return ret;
+}
+
static inline int timespec64_equal(const struct timespec64 *a,
const struct timespec64 *b)
{