diff options
author | john stultz <johnstul@us.ibm.com> | 2005-09-06 18:17:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 19:57:34 -0400 |
commit | b149ee2233edf08fb59b11e879a2c5941929bcb8 (patch) | |
tree | 4ee8e066c4d69ac98afc37ab0ab62ae54271ce02 /arch/x86_64 | |
parent | 6c231b7bab0aa6860cd9da2de8a064eddc34c146 (diff) |
[PATCH] NTP: ntp-helper functions
This patch cleans up a commonly repeated set of changes to the NTP state
variables by adding two helper inline functions:
ntp_clear(): Clears the ntp state variables
ntp_synced(): Returns 1 if the system is synced with a time server.
This was compile tested for alpha, arm, i386, x86-64, ppc64, s390, sparc,
sparc64.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64')
-rw-r--r-- | arch/x86_64/kernel/time.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index 2b5d9da912a2..7b6abe058253 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c | |||
@@ -176,10 +176,7 @@ int do_settimeofday(struct timespec *tv) | |||
176 | set_normalized_timespec(&xtime, sec, nsec); | 176 | set_normalized_timespec(&xtime, sec, nsec); |
177 | set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); | 177 | set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); |
178 | 178 | ||
179 | time_adjust = 0; /* stop active adjtime() */ | 179 | ntp_clear(); |
180 | time_status |= STA_UNSYNC; | ||
181 | time_maxerror = NTP_PHASE_LIMIT; | ||
182 | time_esterror = NTP_PHASE_LIMIT; | ||
183 | 180 | ||
184 | write_sequnlock_irq(&xtime_lock); | 181 | write_sequnlock_irq(&xtime_lock); |
185 | clock_was_set(); | 182 | clock_was_set(); |
@@ -471,7 +468,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
471 | * off) isn't likely to go away much sooner anyway. | 468 | * off) isn't likely to go away much sooner anyway. |
472 | */ | 469 | */ |
473 | 470 | ||
474 | if ((~time_status & STA_UNSYNC) && xtime.tv_sec > rtc_update && | 471 | if (ntp_synced() && xtime.tv_sec > rtc_update && |
475 | abs(xtime.tv_nsec - 500000000) <= tick_nsec / 2) { | 472 | abs(xtime.tv_nsec - 500000000) <= tick_nsec / 2) { |
476 | set_rtc_mmss(xtime.tv_sec); | 473 | set_rtc_mmss(xtime.tv_sec); |
477 | rtc_update = xtime.tv_sec + 660; | 474 | rtc_update = xtime.tv_sec + 660; |