timekeeping: Clean up ktime_get_real_ts64
[linux-2.6-block.git] / include / linux / timekeeping32.h
CommitLineData
6546911e
AB
1#ifndef _LINUX_TIMEKEEPING32_H
2#define _LINUX_TIMEKEEPING32_H
3/*
4 * These interfaces are all based on the old timespec type
5 * and should get replaced with the timespec64 based versions
6 * over time so we can remove the file here.
7 */
8
9extern void do_gettimeofday(struct timeval *tv);
10unsigned long get_seconds(void);
11
6546911e
AB
12static inline struct timespec current_kernel_time(void)
13{
14 struct timespec64 now = current_kernel_time64();
15
16 return timespec64_to_timespec(now);
17}
18
6546911e
AB
19/**
20 * Deprecated. Use do_settimeofday64().
21 */
22static inline int do_settimeofday(const struct timespec *ts)
23{
24 struct timespec64 ts64;
25
26 ts64 = timespec_to_timespec64(*ts);
27 return do_settimeofday64(&ts64);
28}
29
6546911e
AB
30static inline void getnstimeofday(struct timespec *ts)
31{
32 struct timespec64 ts64;
33
edca71fe 34 ktime_get_real_ts64(&ts64);
6546911e
AB
35 *ts = timespec64_to_timespec(ts64);
36}
37
38static inline void ktime_get_ts(struct timespec *ts)
39{
40 struct timespec64 ts64;
41
42 ktime_get_ts64(&ts64);
43 *ts = timespec64_to_timespec(ts64);
44}
45
46static inline void ktime_get_real_ts(struct timespec *ts)
47{
48 struct timespec64 ts64;
49
edca71fe 50 ktime_get_real_ts64(&ts64);
6546911e
AB
51 *ts = timespec64_to_timespec(ts64);
52}
53
54static inline void getrawmonotonic(struct timespec *ts)
55{
56 struct timespec64 ts64;
57
58 getrawmonotonic64(&ts64);
59 *ts = timespec64_to_timespec(ts64);
60}
61
62static inline struct timespec get_monotonic_coarse(void)
63{
64 return timespec64_to_timespec(get_monotonic_coarse64());
65}
66
67static inline void getboottime(struct timespec *ts)
68{
69 struct timespec64 ts64;
70
71 getboottime64(&ts64);
72 *ts = timespec64_to_timespec(ts64);
73}
6546911e
AB
74
75/*
76 * Timespec interfaces utilizing the ktime based ones
77 */
78static inline void get_monotonic_boottime(struct timespec *ts)
79{
80 *ts = ktime_to_timespec(ktime_get_boottime());
81}
82
83static inline void timekeeping_clocktai(struct timespec *ts)
84{
85 *ts = ktime_to_timespec(ktime_get_clocktai());
86}
87
88/*
89 * Persistent clock related interfaces
90 */
91extern void read_persistent_clock(struct timespec *ts);
92extern int update_persistent_clock(struct timespec now);
93
94#endif