Thomas Gleixner | 8b094cd | 2014-07-16 21:04:02 +0000 | [diff] [blame^] | 1 | #ifndef _LINUX_TIMEKEEPING_H |
| 2 | #define _LINUX_TIMEKEEPING_H |
| 3 | |
| 4 | /* Included from linux/ktime.h */ |
| 5 | |
| 6 | void timekeeping_init(void); |
| 7 | extern int timekeeping_suspended; |
| 8 | |
| 9 | /* |
| 10 | * Get and set timeofday |
| 11 | */ |
| 12 | extern void do_gettimeofday(struct timeval *tv); |
| 13 | extern int do_settimeofday(const struct timespec *tv); |
| 14 | extern int do_sys_settimeofday(const struct timespec *tv, |
| 15 | const struct timezone *tz); |
| 16 | |
| 17 | /* |
| 18 | * Kernel time accessors |
| 19 | */ |
| 20 | unsigned long get_seconds(void); |
| 21 | struct timespec current_kernel_time(void); |
| 22 | /* does not take xtime_lock */ |
| 23 | struct timespec __current_kernel_time(void); |
| 24 | |
| 25 | /* |
| 26 | * timespec based interfaces |
| 27 | */ |
| 28 | struct timespec get_monotonic_coarse(void); |
| 29 | extern void getrawmonotonic(struct timespec *ts); |
| 30 | extern void monotonic_to_bootbased(struct timespec *ts); |
| 31 | extern void get_monotonic_boottime(struct timespec *ts); |
| 32 | extern void ktime_get_ts(struct timespec *ts); |
| 33 | |
| 34 | extern int __getnstimeofday(struct timespec *tv); |
| 35 | extern void getnstimeofday(struct timespec *tv); |
| 36 | extern void getboottime(struct timespec *ts); |
| 37 | |
| 38 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) |
| 39 | #define ktime_get_real_ts(ts) getnstimeofday(ts) |
| 40 | |
| 41 | |
| 42 | /* |
| 43 | * ktime_t based interfaces |
| 44 | */ |
| 45 | extern ktime_t ktime_get(void); |
| 46 | extern ktime_t ktime_get_real(void); |
| 47 | extern ktime_t ktime_get_boottime(void); |
| 48 | extern ktime_t ktime_get_monotonic_offset(void); |
| 49 | extern ktime_t ktime_get_clocktai(void); |
| 50 | |
| 51 | /* |
| 52 | * RTC specific |
| 53 | */ |
| 54 | extern void timekeeping_inject_sleeptime(struct timespec *delta); |
| 55 | |
| 56 | /* |
| 57 | * PPS accessor |
| 58 | */ |
| 59 | extern void getnstime_raw_and_real(struct timespec *ts_raw, |
| 60 | struct timespec *ts_real); |
| 61 | |
| 62 | /* |
| 63 | * Persistent clock related interfaces |
| 64 | */ |
| 65 | extern bool persistent_clock_exist; |
| 66 | extern int persistent_clock_is_local; |
| 67 | |
| 68 | static inline bool has_persistent_clock(void) |
| 69 | { |
| 70 | return persistent_clock_exist; |
| 71 | } |
| 72 | |
| 73 | extern void read_persistent_clock(struct timespec *ts); |
| 74 | extern void read_boot_clock(struct timespec *ts); |
| 75 | extern int update_persistent_clock(struct timespec now); |
| 76 | |
| 77 | |
| 78 | #endif |