2 * You SHOULD NOT be including this unless you're vsyscall
3 * handling code or timekeeping internal code!
6 #ifndef _LINUX_TIMEKEEPER_INTERNAL_H
7 #define _LINUX_TIMEKEEPER_INTERNAL_H
9 #include <linux/clocksource.h>
10 #include <linux/jiffies.h>
11 #include <linux/time.h>
14 * Structure holding internal timekeeping values.
16 * Note: wall_to_monotonic is what we need to add to xtime (or xtime
17 * corrected for sub jiffie times) to get to monotonic time.
18 * Monotonic is pegged at zero at system boot time, so
19 * wall_to_monotonic will be negative, however, we will ALWAYS keep
20 * the tv_nsec part positive so we can use the usual normalization.
22 * wall_to_monotonic is moved after resume from suspend for the
23 * monotonic time not to jump. We need to add total_sleep_time to
24 * wall_to_monotonic to get the real boot based time offset.
26 * - wall_to_monotonic is no longer the boot time, getboottime must be
30 /* Current clocksource used for timekeeping. */
31 struct clocksource
*clock
;
32 /* NTP adjusted clock multiplier */
34 /* The shift value of the current clocksource. */
36 /* Clock shifted nano seconds */
39 /* Monotonic base time */
42 /* Current CLOCK_REALTIME time in seconds */
44 /* CLOCK_REALTIME to CLOCK_MONOTONIC offset */
45 struct timespec64 wall_to_monotonic
;
47 /* Offset clock monotonic -> clock realtime */
49 /* Offset clock monotonic -> clock boottime */
51 /* Offset clock monotonic -> clock tai */
54 /* time spent in suspend */
55 struct timespec64 total_sleep_time
;
56 /* The current UTC to TAI offset in seconds */
59 /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */
60 struct timespec64 raw_time
;
62 /* Number of clock cycles in one NTP interval. */
63 cycle_t cycle_interval
;
64 /* Last cycle value (also stored in clock->cycle_last) */
66 /* Number of clock shifted nano seconds in one NTP interval. */
68 /* shifted nano seconds left over when rounding cycle_interval */
70 /* Raw nano seconds accumulated per NTP interval. */
74 * Difference between accumulated time and NTP time in ntp
75 * shifted nano seconds.
79 * Shift conversion between clock shifted nano seconds and
80 * ntp shifted nano seconds.
85 #ifdef CONFIG_GENERIC_TIME_VSYSCALL
87 extern void update_vsyscall(struct timekeeper
*tk
);
88 extern void update_vsyscall_tz(void);
90 #elif defined(CONFIG_GENERIC_TIME_VSYSCALL_OLD)
92 extern void update_vsyscall_old(struct timespec
*ts
, struct timespec
*wtm
,
93 struct clocksource
*c
, u32 mult
);
94 extern void update_vsyscall_tz(void);
98 static inline void update_vsyscall(struct timekeeper
*tk
)
101 static inline void update_vsyscall_tz(void)
106 #endif /* _LINUX_TIMEKEEPER_INTERNAL_H */