aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/timekeeping.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-07-16 17:04:04 -0400
committerJohn Stultz <john.stultz@linaro.org>2014-07-23 13:17:55 -0400
commitd6d29896c665dfd50e6e0be7a9039901640433a3 (patch)
treef6f80e9658798bb94f1aef2b06ddb63d5f32e26d /include/linux/timekeeping.h
parent8b094cd03b4a3793220d8d8d86a173bfea8c285b (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.h66
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);
29extern void getrawmonotonic(struct timespec *ts); 29extern void getrawmonotonic(struct timespec *ts);
30extern void monotonic_to_bootbased(struct timespec *ts); 30extern void monotonic_to_bootbased(struct timespec *ts);
31extern void get_monotonic_boottime(struct timespec *ts); 31extern void get_monotonic_boottime(struct timespec *ts);
32extern void ktime_get_ts(struct timespec *ts); 32extern void ktime_get_ts64(struct timespec64 *ts);
33
34extern int __getnstimeofday64(struct timespec64 *tv);
35extern void getnstimeofday64(struct timespec64 *tv);
36
37#if BITS_PER_LONG == 64
38static inline int __getnstimeofday(struct timespec *ts)
39{
40 return __getnstimeofday64(ts);
41}
42
43static inline void getnstimeofday(struct timespec *ts)
44{
45 getnstimeofday64(ts);
46}
47
48static inline void ktime_get_ts(struct timespec *ts)
49{
50 ktime_get_ts64(ts);
51}
52
53static inline void ktime_get_real_ts(struct timespec *ts)
54{
55 getnstimeofday64(ts);
56}
57
58#else
59static 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
68static inline void getnstimeofday(struct timespec *ts)
69{
70 struct timespec64 ts64;
71
72 getnstimeofday64(&ts64);
73 *ts = timespec64_to_timespec(ts64);
74}
75
76static 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
84static 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
34extern int __getnstimeofday(struct timespec *tv);
35extern void getnstimeofday(struct timespec *tv);
36extern void getboottime(struct timespec *ts); 93extern 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