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 /* does not take xtime_lock */
13 struct timespec __current_kernel_time(void);
15 static inline struct timespec current_kernel_time(void)
17 struct timespec64 now = current_kernel_time64();
19 return timespec64_to_timespec(now);
22 #if BITS_PER_LONG == 64
24 * Deprecated. Use do_settimeofday64().
26 static inline int do_settimeofday(const struct timespec *ts)
28 return do_settimeofday64(ts);
31 static inline int __getnstimeofday(struct timespec *ts)
33 return __getnstimeofday64(ts);
36 static inline void getnstimeofday(struct timespec *ts)
41 static inline void ktime_get_ts(struct timespec *ts)
46 static inline void ktime_get_real_ts(struct timespec *ts)
51 static inline void getrawmonotonic(struct timespec *ts)
53 getrawmonotonic64(ts);
56 static inline struct timespec get_monotonic_coarse(void)
58 return get_monotonic_coarse64();
61 static inline void getboottime(struct timespec *ts)
63 return getboottime64(ts);
67 * Deprecated. Use do_settimeofday64().
69 static inline int do_settimeofday(const struct timespec *ts)
71 struct timespec64 ts64;
73 ts64 = timespec_to_timespec64(*ts);
74 return do_settimeofday64(&ts64);
77 static inline int __getnstimeofday(struct timespec *ts)
79 struct timespec64 ts64;
80 int ret = __getnstimeofday64(&ts64);
82 *ts = timespec64_to_timespec(ts64);
86 static inline void getnstimeofday(struct timespec *ts)
88 struct timespec64 ts64;
90 getnstimeofday64(&ts64);
91 *ts = timespec64_to_timespec(ts64);
94 static inline void ktime_get_ts(struct timespec *ts)
96 struct timespec64 ts64;
98 ktime_get_ts64(&ts64);
99 *ts = timespec64_to_timespec(ts64);
102 static inline void ktime_get_real_ts(struct timespec *ts)
104 struct timespec64 ts64;
106 getnstimeofday64(&ts64);
107 *ts = timespec64_to_timespec(ts64);
110 static inline void getrawmonotonic(struct timespec *ts)
112 struct timespec64 ts64;
114 getrawmonotonic64(&ts64);
115 *ts = timespec64_to_timespec(ts64);
118 static inline struct timespec get_monotonic_coarse(void)
120 return timespec64_to_timespec(get_monotonic_coarse64());
123 static inline void getboottime(struct timespec *ts)
125 struct timespec64 ts64;
127 getboottime64(&ts64);
128 *ts = timespec64_to_timespec(ts64);
133 * Timespec interfaces utilizing the ktime based ones
135 static inline void get_monotonic_boottime(struct timespec *ts)
137 *ts = ktime_to_timespec(ktime_get_boottime());
140 static inline void timekeeping_clocktai(struct timespec *ts)
142 *ts = ktime_to_timespec(ktime_get_clocktai());
146 * Persistent clock related interfaces
148 extern void read_persistent_clock(struct timespec *ts);
149 extern int update_persistent_clock(struct timespec now);