diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2006-10-01 02:28:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:26 -0400 |
commit | dc6a43e46f1b6de22701f97bec022e97088cfa90 (patch) | |
tree | b79c17697fc1f90ea2d6157dbdbf94aded8a0f15 | |
parent | ab8783b688f33c40ed7b37b814a4a1e7d341ce11 (diff) |
[PATCH] ntp: add time_freq to tick length
This adds the frequency part to ntp_update_frequency().
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.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index c09628d6b848..ab21eb06e09b 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
@@ -37,8 +37,7 @@ long time_tolerance = MAXFREQ; /* frequency tolerance (ppm) */ | |||
37 | long time_precision = 1; /* clock precision (us) */ | 37 | long time_precision = 1; /* clock precision (us) */ |
38 | long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ | 38 | long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ |
39 | long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ | 39 | long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ |
40 | long time_freq = (((NSEC_PER_SEC + HZ/2) % HZ - HZ/2) << SHIFT_USEC) / NSEC_PER_USEC; | 40 | long time_freq; /* frequency offset (scaled ppm)*/ |
41 | /* frequency offset (scaled ppm)*/ | ||
42 | long time_reftime; /* time at last adjustment (s) */ | 41 | long time_reftime; /* time at last adjustment (s) */ |
43 | long time_adjust; | 42 | long time_adjust; |
44 | long time_next_adjust; | 43 | long time_next_adjust; |
@@ -67,6 +66,7 @@ void ntp_update_frequency(void) | |||
67 | { | 66 | { |
68 | tick_length_base = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) << TICK_LENGTH_SHIFT; | 67 | tick_length_base = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) << TICK_LENGTH_SHIFT; |
69 | tick_length_base += (s64)CLOCK_TICK_ADJUST << TICK_LENGTH_SHIFT; | 68 | tick_length_base += (s64)CLOCK_TICK_ADJUST << TICK_LENGTH_SHIFT; |
69 | tick_length_base += ((s64)time_freq * NSEC_PER_USEC) << (TICK_LENGTH_SHIFT - SHIFT_USEC); | ||
70 | 70 | ||
71 | do_div(tick_length_base, HZ); | 71 | do_div(tick_length_base, HZ); |
72 | 72 | ||
@@ -163,8 +163,6 @@ void second_overflow(void) | |||
163 | * Compute the frequency estimate and additional phase adjustment due | 163 | * Compute the frequency estimate and additional phase adjustment due |
164 | * to frequency error for the next second. | 164 | * to frequency error for the next second. |
165 | */ | 165 | */ |
166 | ltemp = time_freq; | ||
167 | time_adj += shift_right(ltemp,(SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE)); | ||
168 | 166 | ||
169 | #if HZ == 100 | 167 | #if HZ == 100 |
170 | /* | 168 | /* |
@@ -389,7 +387,7 @@ int do_adjtimex(struct timex *txc) | |||
389 | if (txc->modes & ADJ_TICK) | 387 | if (txc->modes & ADJ_TICK) |
390 | tick_usec = txc->tick; | 388 | tick_usec = txc->tick; |
391 | 389 | ||
392 | if (txc->modes & ADJ_TICK) | 390 | if (txc->modes & (ADJ_TICK|ADJ_FREQUENCY|ADJ_OFFSET)) |
393 | ntp_update_frequency(); | 391 | ntp_update_frequency(); |
394 | } /* txc->modes */ | 392 | } /* txc->modes */ |
395 | leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0) | 393 | leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0) |