Arnd Bergmann | 6546911 | 2017-10-19 13:14:49 +0200 | [diff] [blame] | 1 | #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 Bergmann | 33e2641 | 2018-08-14 15:18:20 +0200 | [diff] [blame^] | 9 | static inline void do_gettimeofday(struct timeval *tv) |
| 10 | { |
| 11 | struct timespec64 now; |
| 12 | |
| 13 | ktime_get_real_ts64(&now); |
| 14 | tv->tv_sec = now.tv_sec; |
| 15 | tv->tv_usec = now.tv_nsec/1000; |
| 16 | } |
| 17 | |
| 18 | static inline unsigned long get_seconds(void) |
| 19 | { |
| 20 | return ktime_get_real_seconds(); |
| 21 | } |
Arnd Bergmann | 6546911 | 2017-10-19 13:14:49 +0200 | [diff] [blame] | 22 | |
Arnd Bergmann | 6546911 | 2017-10-19 13:14:49 +0200 | [diff] [blame] | 23 | static inline void getnstimeofday(struct timespec *ts) |
| 24 | { |
| 25 | struct timespec64 ts64; |
| 26 | |
Arnd Bergmann | edca71f | 2018-04-27 15:40:13 +0200 | [diff] [blame] | 27 | ktime_get_real_ts64(&ts64); |
Arnd Bergmann | 6546911 | 2017-10-19 13:14:49 +0200 | [diff] [blame] | 28 | *ts = timespec64_to_timespec(ts64); |
| 29 | } |
| 30 | |
| 31 | static inline void ktime_get_ts(struct timespec *ts) |
| 32 | { |
| 33 | struct timespec64 ts64; |
| 34 | |
| 35 | ktime_get_ts64(&ts64); |
| 36 | *ts = timespec64_to_timespec(ts64); |
| 37 | } |
| 38 | |
Arnd Bergmann | 6546911 | 2017-10-19 13:14:49 +0200 | [diff] [blame] | 39 | static inline void getrawmonotonic(struct timespec *ts) |
| 40 | { |
| 41 | struct timespec64 ts64; |
| 42 | |
Arnd Bergmann | fb7fcc9 | 2018-04-27 15:40:14 +0200 | [diff] [blame] | 43 | ktime_get_raw_ts64(&ts64); |
Arnd Bergmann | 6546911 | 2017-10-19 13:14:49 +0200 | [diff] [blame] | 44 | *ts = timespec64_to_timespec(ts64); |
| 45 | } |
| 46 | |
Arnd Bergmann | 6546911 | 2017-10-19 13:14:49 +0200 | [diff] [blame] | 47 | static inline void getboottime(struct timespec *ts) |
| 48 | { |
| 49 | struct timespec64 ts64; |
| 50 | |
| 51 | getboottime64(&ts64); |
| 52 | *ts = timespec64_to_timespec(ts64); |
| 53 | } |
Arnd Bergmann | 6546911 | 2017-10-19 13:14:49 +0200 | [diff] [blame] | 54 | |
| 55 | /* |
Arnd Bergmann | 6546911 | 2017-10-19 13:14:49 +0200 | [diff] [blame] | 56 | * Persistent clock related interfaces |
| 57 | */ |
| 58 | extern void read_persistent_clock(struct timespec *ts); |
| 59 | extern int update_persistent_clock(struct timespec now); |
| 60 | |
| 61 | #endif |