diff options
author | John Stultz <johnstul@us.ibm.com> | 2009-08-14 09:47:18 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-08-15 04:55:45 -0400 |
commit | 31089c13bcb18d2cd2a3ddfbe3a28666346f237e (patch) | |
tree | 9db4868a4c524efd6f927a555e43c009a70243a5 /kernel | |
parent | 4cd1993f0046fbc765dbf20af90966f5661e3789 (diff) |
timekeeping: Introduce timekeeping_leap_insert
Move the adjustment of xtime, wall_to_monotonic and the update of the
vsyscall variables to the timekeeping code.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
LKML-Reference: <20090814134807.609730216@de.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/time/ntp.c | 7 | ||||
-rw-r--r-- | kernel/time/timekeeping.c | 7 |
2 files changed, 9 insertions, 5 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 7fc64375ff43..4800f933910e 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
@@ -194,8 +194,7 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) | |||
194 | case TIME_OK: | 194 | case TIME_OK: |
195 | break; | 195 | break; |
196 | case TIME_INS: | 196 | case TIME_INS: |
197 | xtime.tv_sec--; | 197 | timekeeping_leap_insert(-1); |
198 | wall_to_monotonic.tv_sec++; | ||
199 | time_state = TIME_OOP; | 198 | time_state = TIME_OOP; |
200 | printk(KERN_NOTICE | 199 | printk(KERN_NOTICE |
201 | "Clock: inserting leap second 23:59:60 UTC\n"); | 200 | "Clock: inserting leap second 23:59:60 UTC\n"); |
@@ -203,9 +202,8 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) | |||
203 | res = HRTIMER_RESTART; | 202 | res = HRTIMER_RESTART; |
204 | break; | 203 | break; |
205 | case TIME_DEL: | 204 | case TIME_DEL: |
206 | xtime.tv_sec++; | 205 | timekeeping_leap_insert(1); |
207 | time_tai--; | 206 | time_tai--; |
208 | wall_to_monotonic.tv_sec--; | ||
209 | time_state = TIME_WAIT; | 207 | time_state = TIME_WAIT; |
210 | printk(KERN_NOTICE | 208 | printk(KERN_NOTICE |
211 | "Clock: deleting leap second 23:59:59 UTC\n"); | 209 | "Clock: deleting leap second 23:59:59 UTC\n"); |
@@ -219,7 +217,6 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) | |||
219 | time_state = TIME_OK; | 217 | time_state = TIME_OK; |
220 | break; | 218 | break; |
221 | } | 219 | } |
222 | update_vsyscall(&xtime, clock); | ||
223 | 220 | ||
224 | write_sequnlock(&xtime_lock); | 221 | write_sequnlock(&xtime_lock); |
225 | 222 | ||
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 02c0b2c9c674..b8b70fb545fc 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -58,6 +58,13 @@ void update_xtime_cache(u64 nsec) | |||
58 | 58 | ||
59 | struct clocksource *clock; | 59 | struct clocksource *clock; |
60 | 60 | ||
61 | /* must hold xtime_lock */ | ||
62 | void timekeeping_leap_insert(int leapsecond) | ||
63 | { | ||
64 | xtime.tv_sec += leapsecond; | ||
65 | wall_to_monotonic.tv_sec -= leapsecond; | ||
66 | update_vsyscall(&xtime, clock); | ||
67 | } | ||
61 | 68 | ||
62 | #ifdef CONFIG_GENERIC_TIME | 69 | #ifdef CONFIG_GENERIC_TIME |
63 | /** | 70 | /** |