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 static inline void do_gettimeofday(struct timeval *tv)
11 struct timespec64 now;
13 ktime_get_real_ts64(&now);
14 tv->tv_sec = now.tv_sec;
15 tv->tv_usec = now.tv_nsec/1000;
18 static inline unsigned long get_seconds(void)
20 return ktime_get_real_seconds();
23 static inline struct timespec current_kernel_time(void)
25 struct timespec64 ts64;
27 ktime_get_coarse_real_ts64(&ts64);
29 return timespec64_to_timespec(ts64);
33 * Deprecated. Use do_settimeofday64().
35 static inline int do_settimeofday(const struct timespec *ts)
37 struct timespec64 ts64;
39 ts64 = timespec_to_timespec64(*ts);
40 return do_settimeofday64(&ts64);
43 static inline void getnstimeofday(struct timespec *ts)
45 struct timespec64 ts64;
47 ktime_get_real_ts64(&ts64);
48 *ts = timespec64_to_timespec(ts64);
51 static inline void ktime_get_ts(struct timespec *ts)
53 struct timespec64 ts64;
55 ktime_get_ts64(&ts64);
56 *ts = timespec64_to_timespec(ts64);
59 static inline void ktime_get_real_ts(struct timespec *ts)
61 struct timespec64 ts64;
63 ktime_get_real_ts64(&ts64);
64 *ts = timespec64_to_timespec(ts64);
67 static inline void getrawmonotonic(struct timespec *ts)
69 struct timespec64 ts64;
71 ktime_get_raw_ts64(&ts64);
72 *ts = timespec64_to_timespec(ts64);
75 static inline struct timespec get_monotonic_coarse(void)
77 struct timespec64 ts64;
79 ktime_get_coarse_ts64(&ts64);
81 return timespec64_to_timespec(ts64);
84 static inline void getboottime(struct timespec *ts)
86 struct timespec64 ts64;
89 *ts = timespec64_to_timespec(ts64);
93 * Timespec interfaces utilizing the ktime based ones
95 static inline void get_monotonic_boottime(struct timespec *ts)
97 *ts = ktime_to_timespec(ktime_get_boottime());
100 static inline void timekeeping_clocktai(struct timespec *ts)
102 *ts = ktime_to_timespec(ktime_get_clocktai());
106 * Persistent clock related interfaces
108 extern void read_persistent_clock(struct timespec *ts);
109 extern int update_persistent_clock(struct timespec now);