aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/timex.h9
-rw-r--r--kernel/time/ntp.c4
2 files changed, 8 insertions, 5 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). */
238extern u64 current_tick_length(void); 245extern u64 current_tick_length(void);
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index e64efaf957e8..c88b5910e7ab 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -43,10 +43,6 @@ long time_freq; /* frequency offset (scaled ppm)*/
43static long time_reftime; /* time at last adjustment (s) */ 43static long time_reftime; /* time at last adjustment (s) */
44long time_adjust; 44long time_adjust;
45 45
46#define CLOCK_TICK_OVERFLOW (LATCH * HZ - CLOCK_TICK_RATE)
47#define CLOCK_TICK_ADJUST (((s64)CLOCK_TICK_OVERFLOW * NSEC_PER_SEC) / \
48 (s64)CLOCK_TICK_RATE)
49
50static void ntp_update_frequency(void) 46static void ntp_update_frequency(void)
51{ 47{
52 u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) 48 u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ)