diff options
author | john stultz <johnstul@us.ibm.com> | 2008-02-10 04:48:03 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-02-10 04:48:03 -0500 |
commit | e13a2e61dd5152f5499d2003470acf9c838eab84 (patch) | |
tree | 4846b2ea392773f7a92d31334295d7aadbafd83e /include/linux/timex.h | |
parent | 25f666300625d894ebe04bac2b4b3aadb907c861 (diff) |
ntp: correct inconsistent interval/tick_length usage
clocksource initialization and error accumulation. This corrects a 280ppm
drift seen on some systems using acpi_pm, and affects other clocksources as
well (likely to a lesser degree).
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/timex.h')
-rw-r--r-- | include/linux/timex.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/timex.h b/include/linux/timex.h index 8ea3e71ba7fa..c3f374786a43 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
@@ -232,7 +232,14 @@ static inline int ntp_synced(void) | |||
232 | #else | 232 | #else |
233 | #define NTP_INTERVAL_FREQ (HZ) | 233 | #define NTP_INTERVAL_FREQ (HZ) |
234 | #endif | 234 | #endif |
235 | #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) | 235 | |
236 | #define CLOCK_TICK_OVERFLOW (LATCH * HZ - CLOCK_TICK_RATE) | ||
237 | #define CLOCK_TICK_ADJUST (((s64)CLOCK_TICK_OVERFLOW * NSEC_PER_SEC) / \ | ||
238 | (s64)CLOCK_TICK_RATE) | ||
239 | |||
240 | /* Because using NSEC_PER_SEC would be too easy */ | ||
241 | #define NTP_INTERVAL_LENGTH ((((s64)TICK_USEC * NSEC_PER_USEC * USER_HZ) + \ | ||
242 | CLOCK_TICK_ADJUST) / NTP_INTERVAL_FREQ) | ||
236 | 243 | ||
237 | /* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ | 244 | /* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ |
238 | extern u64 current_tick_length(void); | 245 | extern u64 current_tick_length(void); |