aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2006-10-01 02:28:23 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-01 03:39:26 -0400
commitab8783b688f33c40ed7b37b814a4a1e7d341ce11 (patch)
tree0c0813bc08f9532fe48135126b4809285de39007
parentb0ee75561beadc4db4d9a899c8ef4a7db50aa0ab (diff)
[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: Roman Zippel <zippel@linux-m68k.org> Cc: john stultz <johnstul@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--kernel/time/ntp.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 77137bec2aea..c09628d6b848 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -39,7 +39,6 @@ long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */
39long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ 39long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */
40long time_freq = (((NSEC_PER_SEC + HZ/2) % HZ - HZ/2) << SHIFT_USEC) / NSEC_PER_USEC; 40long time_freq = (((NSEC_PER_SEC + HZ/2) % HZ - HZ/2) << SHIFT_USEC) / NSEC_PER_USEC;
41 /* frequency offset (scaled ppm)*/ 41 /* frequency offset (scaled ppm)*/
42static long time_adj; /* tick adjust (scaled 1 / HZ) */
43long time_reftime; /* time at last adjustment (s) */ 42long time_reftime; /* time at last adjustment (s) */
44long time_adjust; 43long time_adjust;
45long time_next_adjust; 44long time_next_adjust;
@@ -84,7 +83,7 @@ void ntp_update_frequency(void)
84 */ 83 */
85void second_overflow(void) 84void second_overflow(void)
86{ 85{
87 long ltemp; 86 long ltemp, time_adj;
88 87
89 /* Bump the maxerror field */ 88 /* Bump the maxerror field */
90 time_maxerror += time_tolerance >> SHIFT_USEC; 89 time_maxerror += time_tolerance >> SHIFT_USEC;
@@ -189,6 +188,7 @@ void second_overflow(void)
189 time_adj += shift_right(time_adj, 6) + shift_right(time_adj, 7); 188 time_adj += shift_right(time_adj, 6) + shift_right(time_adj, 7);
190#endif 189#endif
191 tick_length = tick_length_base; 190 tick_length = tick_length_base;
191 tick_length += (s64)time_adj << (TICK_LENGTH_SHIFT - (SHIFT_SCALE - 10));
192} 192}
193 193
194/* 194/*
@@ -245,11 +245,9 @@ u64 current_tick_length(void)
245 u64 ret; 245 u64 ret;
246 246
247 /* calculate the finest interval NTP will allow. 247 /* calculate the finest interval NTP will allow.
248 * ie: nanosecond value shifted by (SHIFT_SCALE - 10)
249 */ 248 */
250 ret = tick_length; 249 ret = tick_length;
251 ret += (u64)(adjtime_adjustment() * 1000) << TICK_LENGTH_SHIFT; 250 ret += (u64)(adjtime_adjustment() * 1000) << TICK_LENGTH_SHIFT;
252 ret += (s64)time_adj << (TICK_LENGTH_SHIFT - (SHIFT_SCALE - 10));
253 251
254 return ret; 252 return ret;
255} 253}