From bbd68b0a6192eb584bc69ff125b8a12794d9c2a9 Mon Sep 17 00:00:00 2001 From: John Stultz Date: Fri, 14 Aug 2009 15:47:18 +0200 Subject: [PATCH] --- yaml --- r: 163056 b: refs/heads/master c: 31089c13bcb18d2cd2a3ddfbe3a28666346f237e h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/time.h | 1 + trunk/kernel/time/ntp.c | 7 ++----- trunk/kernel/time/timekeeping.c | 7 +++++++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index a1b54382732f..b6b5dfd04a3c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4cd1993f0046fbc765dbf20af90966f5661e3789 +refs/heads/master: 31089c13bcb18d2cd2a3ddfbe3a28666346f237e diff --git a/trunk/include/linux/time.h b/trunk/include/linux/time.h index ea16c1a01d51..e7c844558884 100644 --- a/trunk/include/linux/time.h +++ b/trunk/include/linux/time.h @@ -147,6 +147,7 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran); extern int timekeeping_valid_for_hres(void); extern void update_wall_time(void); extern void update_xtime_cache(u64 nsec); +extern void timekeeping_leap_insert(int leapsecond); struct tms; extern void do_sys_times(struct tms *); diff --git a/trunk/kernel/time/ntp.c b/trunk/kernel/time/ntp.c index 7fc64375ff43..4800f933910e 100644 --- a/trunk/kernel/time/ntp.c +++ b/trunk/kernel/time/ntp.c @@ -194,8 +194,7 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) case TIME_OK: break; case TIME_INS: - xtime.tv_sec--; - wall_to_monotonic.tv_sec++; + timekeeping_leap_insert(-1); time_state = TIME_OOP; printk(KERN_NOTICE "Clock: inserting leap second 23:59:60 UTC\n"); @@ -203,9 +202,8 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) res = HRTIMER_RESTART; break; case TIME_DEL: - xtime.tv_sec++; + timekeeping_leap_insert(1); time_tai--; - wall_to_monotonic.tv_sec--; time_state = TIME_WAIT; printk(KERN_NOTICE "Clock: deleting leap second 23:59:59 UTC\n"); @@ -219,7 +217,6 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer) time_state = TIME_OK; break; } - update_vsyscall(&xtime, clock); write_sequnlock(&xtime_lock); diff --git a/trunk/kernel/time/timekeeping.c b/trunk/kernel/time/timekeeping.c index 02c0b2c9c674..b8b70fb545fc 100644 --- a/trunk/kernel/time/timekeeping.c +++ b/trunk/kernel/time/timekeeping.c @@ -58,6 +58,13 @@ void update_xtime_cache(u64 nsec) struct clocksource *clock; +/* must hold xtime_lock */ +void timekeeping_leap_insert(int leapsecond) +{ + xtime.tv_sec += leapsecond; + wall_to_monotonic.tv_sec -= leapsecond; + update_vsyscall(&xtime, clock); +} #ifdef CONFIG_GENERIC_TIME /**