diff options
author | John Stultz <john.stultz@linaro.org> | 2014-07-16 17:03:56 -0400 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2014-07-23 13:16:50 -0400 |
commit | b17b20d70dcbe48dd1aa6aba073a60ddfce5d7db (patch) | |
tree | 6df427dd2be7ec76727016cb83214cd2338f9736 /include | |
parent | 166afb64511eef08e13331b970c44fe91cea45ef (diff) |
ktime: Change ktime_set() to take 64bit seconds value
In order to support dates past 2038 on 32bit systems, ktime_set()
needs to handle 64bit second values.
[ tglx: Removed the BITS_PER_LONG check ]
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')
-rw-r--r-- | include/linux/ktime.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 74eaba9b3569..538c283714e1 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
@@ -47,13 +47,12 @@ typedef union ktime ktime_t; /* Kill this */ | |||
47 | * | 47 | * |
48 | * Return: The ktime_t representation of the value. | 48 | * Return: The ktime_t representation of the value. |
49 | */ | 49 | */ |
50 | static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) | 50 | static inline ktime_t ktime_set(const s64 secs, const unsigned long nsecs) |
51 | { | 51 | { |
52 | #if (BITS_PER_LONG == 64) | ||
53 | if (unlikely(secs >= KTIME_SEC_MAX)) | 52 | if (unlikely(secs >= KTIME_SEC_MAX)) |
54 | return (ktime_t){ .tv64 = KTIME_MAX }; | 53 | return (ktime_t){ .tv64 = KTIME_MAX }; |
55 | #endif | 54 | |
56 | return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; | 55 | return (ktime_t) { .tv64 = secs * NSEC_PER_SEC + (s64)nsecs }; |
57 | } | 56 | } |
58 | 57 | ||
59 | /* Subtract two ktime_t variables. rem = lhs -rhs: */ | 58 | /* Subtract two ktime_t variables. rem = lhs -rhs: */ |