diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2008-05-01 07:34:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-01 11:03:59 -0400 |
commit | 153b5d054ac2d98ea0d86504884326b6777f683d (patch) | |
tree | 0512b4239959814a6cc6aa6c9e77abc36d3ab2f0 /kernel/time/ntp.c | |
parent | 9f14f669d18477fe3df071e2fa4da36c00acee8e (diff) |
ntp: support for TAI
This adds support for setting the TAI value (International Atomic Time). The
value is reported back to userspace via timex (as we don't have a
ntp_gettime() syscall).
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/time/ntp.c')
-rw-r--r-- | kernel/time/ntp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 44491de312a0..10fe17df45a0 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
@@ -35,6 +35,7 @@ static u64 tick_length, tick_length_base; | |||
35 | /* TIME_ERROR prevents overwriting the CMOS clock */ | 35 | /* TIME_ERROR prevents overwriting the CMOS clock */ |
36 | static int time_state = TIME_OK; /* clock synchronization status */ | 36 | static int time_state = TIME_OK; /* clock synchronization status */ |
37 | int time_status = STA_UNSYNC; /* clock status bits */ | 37 | int time_status = STA_UNSYNC; /* clock status bits */ |
38 | static long time_tai; /* TAI offset (s) */ | ||
38 | static s64 time_offset; /* time adjustment (ns) */ | 39 | static s64 time_offset; /* time adjustment (ns) */ |
39 | static long time_constant = 2; /* pll time constant */ | 40 | static long time_constant = 2; /* pll time constant */ |
40 | long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ | 41 | long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ |
@@ -162,6 +163,7 @@ void second_overflow(void) | |||
162 | case TIME_DEL: | 163 | case TIME_DEL: |
163 | if ((xtime.tv_sec + 1) % 86400 == 0) { | 164 | if ((xtime.tv_sec + 1) % 86400 == 0) { |
164 | xtime.tv_sec++; | 165 | xtime.tv_sec++; |
166 | time_tai--; | ||
165 | wall_to_monotonic.tv_sec--; | 167 | wall_to_monotonic.tv_sec--; |
166 | time_state = TIME_WAIT; | 168 | time_state = TIME_WAIT; |
167 | printk(KERN_NOTICE "Clock: deleting leap second " | 169 | printk(KERN_NOTICE "Clock: deleting leap second " |
@@ -169,6 +171,7 @@ void second_overflow(void) | |||
169 | } | 171 | } |
170 | break; | 172 | break; |
171 | case TIME_OOP: | 173 | case TIME_OOP: |
174 | time_tai++; | ||
172 | time_state = TIME_WAIT; | 175 | time_state = TIME_WAIT; |
173 | break; | 176 | break; |
174 | case TIME_WAIT: | 177 | case TIME_WAIT: |
@@ -340,6 +343,9 @@ int do_adjtimex(struct timex *txc) | |||
340 | time_constant = max(time_constant, 0l); | 343 | time_constant = max(time_constant, 0l); |
341 | } | 344 | } |
342 | 345 | ||
346 | if (txc->modes & ADJ_TAI && txc->constant > 0) | ||
347 | time_tai = txc->constant; | ||
348 | |||
343 | if (txc->modes & ADJ_OFFSET) { | 349 | if (txc->modes & ADJ_OFFSET) { |
344 | if (txc->modes == ADJ_OFFSET_SINGLESHOT) | 350 | if (txc->modes == ADJ_OFFSET_SINGLESHOT) |
345 | /* adjtime() is independent from ntp_adjtime() */ | 351 | /* adjtime() is independent from ntp_adjtime() */ |
@@ -377,6 +383,7 @@ int do_adjtimex(struct timex *txc) | |||
377 | txc->precision = 1; | 383 | txc->precision = 1; |
378 | txc->tolerance = MAXFREQ_SCALED / PPM_SCALE; | 384 | txc->tolerance = MAXFREQ_SCALED / PPM_SCALE; |
379 | txc->tick = tick_usec; | 385 | txc->tick = tick_usec; |
386 | txc->tai = time_tai; | ||
380 | 387 | ||
381 | /* PPS is not implemented, so these are zero */ | 388 | /* PPS is not implemented, so these are zero */ |
382 | txc->ppsfreq = 0; | 389 | txc->ppsfreq = 0; |