1 #ifndef _LINUX_TIMEKEEPING32_H
2 #define _LINUX_TIMEKEEPING32_H
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.
9 extern void do_gettimeofday(struct timeval *tv);
10 unsigned long get_seconds(void);
12 static inline struct timespec current_kernel_time(void)
14 struct timespec64 now = current_kernel_time64();
16 return timespec64_to_timespec(now);
19 #if BITS_PER_LONG == 64
21 * Deprecated. Use do_settimeofday64().
23 static inline int do_settimeofday(const struct timespec *ts)
25 return do_settimeofday64(ts);
28 static inline int __getnstimeofday(struct timespec *ts)
30 return __getnstimeofday64(ts);
33 static inline void getnstimeofday(struct timespec *ts)
38 static inline void ktime_get_ts(struct timespec *ts)
43 static inline void ktime_get_real_ts(struct timespec *ts)
48 static inline void getrawmonotonic(struct timespec *ts)
50 getrawmonotonic64(ts);
53 static inline struct timespec get_monotonic_coarse(void)
55 return get_monotonic_coarse64();
58 static inline void getboottime(struct timespec *ts)
60 return getboottime64(ts);
64 * Deprecated. Use do_settimeofday64().
66 static inline int do_settimeofday(const struct timespec *ts)
68 struct timespec64 ts64;
70 ts64 = timespec_to_timespec64(*ts);
71 return do_settimeofday64(&ts64);
74 static inline int __getnstimeofday(struct timespec *ts)
76 struct timespec64 ts64;
77 int ret = __getnstimeofday64(&ts64);
79 *ts = timespec64_to_timespec(ts64);
83 static inline void getnstimeofday(struct timespec *ts)
85 struct timespec64 ts64;
87 getnstimeofday64(&ts64);
88 *ts = timespec64_to_timespec(ts64);
91 static inline void ktime_get_ts(struct timespec *ts)
93 struct timespec64 ts64;
95 ktime_get_ts64(&ts64);
96 *ts = timespec64_to_timespec(ts64);
99 static inline void ktime_get_real_ts(struct timespec *ts)
101 struct timespec64 ts64;
103 getnstimeofday64(&ts64);
104 *ts = timespec64_to_timespec(ts64);
107 static inline void getrawmonotonic(struct timespec *ts)
109 struct timespec64 ts64;
111 getrawmonotonic64(&ts64);
112 *ts = timespec64_to_timespec(ts64);
115 static inline struct timespec get_monotonic_coarse(void)
117 return timespec64_to_timespec(get_monotonic_coarse64());
120 static inline void getboottime(struct timespec *ts)
122 struct timespec64 ts64;
124 getboottime64(&ts64);
125 *ts = timespec64_to_timespec(ts64);
130 * Timespec interfaces utilizing the ktime based ones
132 static inline void get_monotonic_boottime(struct timespec *ts)
134 *ts = ktime_to_timespec(ktime_get_boottime());
137 static inline void timekeeping_clocktai(struct timespec *ts)
139 *ts = ktime_to_timespec(ktime_get_clocktai());
143 * Persistent clock related interfaces
145 extern void read_persistent_clock(struct timespec *ts);
146 extern int update_persistent_clock(struct timespec now);