Commit ab8783b6 authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

[PATCH] ntp: add time_adj to tick length

This makes time_adj local to second_overflow() and integrates it into the tick
length instead of adding it everytime.
Signed-off-by: default avatarRoman Zippel <zippel@linux-m68k.org>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b0ee7556
...@@ -39,7 +39,6 @@ long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ ...@@ -39,7 +39,6 @@ long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */
long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */
long time_freq = (((NSEC_PER_SEC + HZ/2) % HZ - HZ/2) << SHIFT_USEC) / NSEC_PER_USEC; long time_freq = (((NSEC_PER_SEC + HZ/2) % HZ - HZ/2) << SHIFT_USEC) / NSEC_PER_USEC;
/* frequency offset (scaled ppm)*/ /* frequency offset (scaled ppm)*/
static long time_adj; /* tick adjust (scaled 1 / HZ) */
long time_reftime; /* time at last adjustment (s) */ long time_reftime; /* time at last adjustment (s) */
long time_adjust; long time_adjust;
long time_next_adjust; long time_next_adjust;
...@@ -84,7 +83,7 @@ void ntp_update_frequency(void) ...@@ -84,7 +83,7 @@ void ntp_update_frequency(void)
*/ */
void second_overflow(void) void second_overflow(void)
{ {
long ltemp; long ltemp, time_adj;
/* Bump the maxerror field */ /* Bump the maxerror field */
time_maxerror += time_tolerance >> SHIFT_USEC; time_maxerror += time_tolerance >> SHIFT_USEC;
...@@ -189,6 +188,7 @@ void second_overflow(void) ...@@ -189,6 +188,7 @@ void second_overflow(void)
time_adj += shift_right(time_adj, 6) + shift_right(time_adj, 7); time_adj += shift_right(time_adj, 6) + shift_right(time_adj, 7);
#endif #endif
tick_length = tick_length_base; tick_length = tick_length_base;
tick_length += (s64)time_adj << (TICK_LENGTH_SHIFT - (SHIFT_SCALE - 10));
} }
/* /*
...@@ -245,11 +245,9 @@ u64 current_tick_length(void) ...@@ -245,11 +245,9 @@ u64 current_tick_length(void)
u64 ret; u64 ret;
/* calculate the finest interval NTP will allow. /* calculate the finest interval NTP will allow.
* ie: nanosecond value shifted by (SHIFT_SCALE - 10)
*/ */
ret = tick_length; ret = tick_length;
ret += (u64)(adjtime_adjustment() * 1000) << TICK_LENGTH_SHIFT; ret += (u64)(adjtime_adjustment() * 1000) << TICK_LENGTH_SHIFT;
ret += (s64)time_adj << (TICK_LENGTH_SHIFT - (SHIFT_SCALE - 10));
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment