blob: cc59cc9e0e841dc8980882837afb03a5ae10a51e [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
Arnd Bergmann33e26412018-08-14 15:18:20 +02009static inline unsigned long get_seconds(void)
10{
11 return ktime_get_real_seconds();
12}
Arnd Bergmann65469112017-10-19 13:14:49 +020013
Arnd Bergmann65469112017-10-19 13:14:49 +020014static inline void getnstimeofday(struct timespec *ts)
15{
16 struct timespec64 ts64;
17
Arnd Bergmannedca71f2018-04-27 15:40:13 +020018 ktime_get_real_ts64(&ts64);
Arnd Bergmann65469112017-10-19 13:14:49 +020019 *ts = timespec64_to_timespec(ts64);
20}
21
22static inline void ktime_get_ts(struct timespec *ts)
23{
24 struct timespec64 ts64;
25
26 ktime_get_ts64(&ts64);
27 *ts = timespec64_to_timespec(ts64);
28}
29
Arnd Bergmann65469112017-10-19 13:14:49 +020030static inline void getrawmonotonic(struct timespec *ts)
31{
32 struct timespec64 ts64;
33
Arnd Bergmannfb7fcc92018-04-27 15:40:14 +020034 ktime_get_raw_ts64(&ts64);
Arnd Bergmann65469112017-10-19 13:14:49 +020035 *ts = timespec64_to_timespec(ts64);
36}
37
Arnd Bergmann65469112017-10-19 13:14:49 +020038static inline void getboottime(struct timespec *ts)
39{
40 struct timespec64 ts64;
41
42 getboottime64(&ts64);
43 *ts = timespec64_to_timespec(ts64);
44}
Arnd Bergmann65469112017-10-19 13:14:49 +020045
Arnd Bergmann65469112017-10-19 13:14:49 +020046#endif