diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-07-16 17:04:04 -0400 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2014-07-23 13:17:55 -0400 |
commit | d6d29896c665dfd50e6e0be7a9039901640433a3 (patch) | |
tree | f6f80e9658798bb94f1aef2b06ddb63d5f32e26d /include/linux/timekeeping.h | |
parent | 8b094cd03b4a3793220d8d8d86a173bfea8c285b (diff) |
timekeeping: Provide timespec64 based interfaces
To convert callers of the core code to timespec64 we need to provide
the proper interfaces.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'include/linux/timekeeping.h')
-rw-r--r-- | include/linux/timekeeping.h | 66 |
1 files changed, 61 insertions, 5 deletions
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index e81c35b71da7..3eb19e34cc20 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h | |||
@@ -29,15 +29,71 @@ struct timespec get_monotonic_coarse(void); | |||
29 | extern void getrawmonotonic(struct timespec *ts); | 29 | extern void getrawmonotonic(struct timespec *ts); |
30 | extern void monotonic_to_bootbased(struct timespec *ts); | 30 | extern void monotonic_to_bootbased(struct timespec *ts); |
31 | extern void get_monotonic_boottime(struct timespec *ts); | 31 | extern void get_monotonic_boottime(struct timespec *ts); |
32 | extern void ktime_get_ts(struct timespec *ts); | 32 | extern void ktime_get_ts64(struct timespec64 *ts); |
33 | |||
34 | extern int __getnstimeofday64(struct timespec64 *tv); | ||
35 | extern void getnstimeofday64(struct timespec64 *tv); | ||
36 | |||
37 | #if BITS_PER_LONG == 64 | ||
38 | static inline int __getnstimeofday(struct timespec *ts) | ||
39 | { | ||
40 | return __getnstimeofday64(ts); | ||
41 | } | ||
42 | |||
43 | static inline void getnstimeofday(struct timespec *ts) | ||
44 | { | ||
45 | getnstimeofday64(ts); | ||
46 | } | ||
47 | |||
48 | static inline void ktime_get_ts(struct timespec *ts) | ||
49 | { | ||
50 | ktime_get_ts64(ts); | ||
51 | } | ||
52 | |||
53 | static inline void ktime_get_real_ts(struct timespec *ts) | ||
54 | { | ||
55 | getnstimeofday64(ts); | ||
56 | } | ||
57 | |||
58 | #else | ||
59 | static inline int __getnstimeofday(struct timespec *ts) | ||
60 | { | ||
61 | struct timespec64 ts64; | ||
62 | int ret = __getnstimeofday64(&ts64); | ||
63 | |||
64 | *ts = timespec64_to_timespec(ts64); | ||
65 | return ret; | ||
66 | } | ||
67 | |||
68 | static inline void getnstimeofday(struct timespec *ts) | ||
69 | { | ||
70 | struct timespec64 ts64; | ||
71 | |||
72 | getnstimeofday64(&ts64); | ||
73 | *ts = timespec64_to_timespec(ts64); | ||
74 | } | ||
75 | |||
76 | static inline void ktime_get_ts(struct timespec *ts) | ||
77 | { | ||
78 | struct timespec64 ts64; | ||
79 | |||
80 | ktime_get_ts64(&ts64); | ||
81 | *ts = timespec64_to_timespec(ts64); | ||
82 | } | ||
83 | |||
84 | static inline void ktime_get_real_ts(struct timespec *ts) | ||
85 | { | ||
86 | struct timespec64 ts64; | ||
87 | |||
88 | getnstimeofday64(&ts64); | ||
89 | *ts = timespec64_to_timespec(ts64); | ||
90 | } | ||
91 | #endif | ||
33 | 92 | ||
34 | extern int __getnstimeofday(struct timespec *tv); | ||
35 | extern void getnstimeofday(struct timespec *tv); | ||
36 | extern void getboottime(struct timespec *ts); | 93 | extern void getboottime(struct timespec *ts); |
37 | 94 | ||
38 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) | 95 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) |
39 | #define ktime_get_real_ts(ts) getnstimeofday(ts) | 96 | #define ktime_get_real_ts64(ts) getnstimeofday64(ts) |
40 | |||
41 | 97 | ||
42 | /* | 98 | /* |
43 | * ktime_t based interfaces | 99 | * ktime_t based interfaces |