aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/time64.h
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2014-07-16 17:03:59 -0400
committerJohn Stultz <john.stultz@linaro.org>2014-07-23 13:17:53 -0400
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 e7b499e1cd79..a3831478d9cf 100644
--- a/include/linux/time64.h
+++ b/include/linux/time64.h
@@ -33,6 +33,16 @@ struct timespec64 {
33 33
34#if __BITS_PER_LONG == 64 34#if __BITS_PER_LONG == 64
35 35
36static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
37{
38 return ts64;
39}
40
41static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
42{
43 return ts;
44}
45
36# define timespec64_equal timespec_equal 46# define timespec64_equal timespec_equal
37# define timespec64_compare timespec_compare 47# define timespec64_compare timespec_compare
38# define set_normalized_timespec64 set_normalized_timespec 48# define set_normalized_timespec64 set_normalized_timespec
@@ -47,6 +57,24 @@ struct timespec64 {
47 57
48#else 58#else
49 59
60static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64)
61{
62 struct timespec ret;
63
64 ret.tv_sec = (time_t)ts64.tv_sec;
65 ret.tv_nsec = ts64.tv_nsec;
66 return ret;
67}
68
69static inline struct timespec64 timespec_to_timespec64(const struct timespec ts)
70{
71 struct timespec64 ret;
72
73 ret.tv_sec = ts.tv_sec;
74 ret.tv_nsec = ts.tv_nsec;
75 return ret;
76}
77
50static inline int timespec64_equal(const struct timespec64 *a, 78static inline int timespec64_equal(const struct timespec64 *a,
51 const struct timespec64 *b) 79 const struct timespec64 *b)
52{ 80{