blob: a4a4991160fb2f759581a6d94868cad8bd9458ba [file] [log] [blame]
Arnd Bergmann65469112017-10-19 13:14:49 +02001#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
Arnd Bergmann65469112017-10-19 13:14:49 +020012static inline void getnstimeofday(struct timespec *ts)
13{
14 struct timespec64 ts64;
15
Arnd Bergmannedca71f2018-04-27 15:40:13 +020016 ktime_get_real_ts64(&ts64);
Arnd Bergmann65469112017-10-19 13:14:49 +020017 *ts = timespec64_to_timespec(ts64);
18}
19
20static inline void ktime_get_ts(struct timespec *ts)
21{
22 struct timespec64 ts64;
23
24 ktime_get_ts64(&ts64);
25 *ts = timespec64_to_timespec(ts64);
26}
27
Arnd Bergmann65469112017-10-19 13:14:49 +020028static inline void getrawmonotonic(struct timespec *ts)
29{
30 struct timespec64 ts64;
31
Arnd Bergmannfb7fcc92018-04-27 15:40:14 +020032 ktime_get_raw_ts64(&ts64);
Arnd Bergmann65469112017-10-19 13:14:49 +020033 *ts = timespec64_to_timespec(ts64);
34}
35
Arnd Bergmann65469112017-10-19 13:14:49 +020036static inline void getboottime(struct timespec *ts)
37{
38 struct timespec64 ts64;
39
40 getboottime64(&ts64);
41 *ts = timespec64_to_timespec(ts64);
42}
Arnd Bergmann65469112017-10-19 13:14:49 +020043
44/*
Arnd Bergmann65469112017-10-19 13:14:49 +020045 * Persistent clock related interfaces
46 */
47extern void read_persistent_clock(struct timespec *ts);
48extern int update_persistent_clock(struct timespec now);
49
50#endif