diff options
-rw-r--r-- | include/linux/time.h | 1 | ||||
-rw-r--r-- | kernel/time/ntp.c | 7 | ||||
-rw-r--r-- | kernel/time/timekeeping.c | 7 |
3 files changed, 10 insertions, 5 deletions
diff --git a/include/linux/time.h b/include/linux/time.h index ea16c1a01d51..e7c844558884 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -147,6 +147,7 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran); | |||
147 | extern int timekeeping_valid_for_hres(void); | 147 | extern int timekeeping_valid_for_hres(void); |
148 | extern void update_wall_time(void); | 148 | extern void update_wall_time(void); |
149 | extern void update_xtime_cache(u64 nsec); | 149 | extern void update_xtime_cache(u64 nsec); |
150 | extern void timekeeping_leap_insert(int leapsecond); | ||
150 | 151 | ||
151 | struct tms; | 152 | struct tms; |
152 | extern void do_sys_times(struct tms *); | 153 | extern void do_sys_times(struct tms *); |
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 | /** |