[tip:timers/core] timekeeping: Use inject_offset in warp_clock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  7859e404ae73fe4f38b8cfc1af19ea82f153084e
Gitweb:     http://git.kernel.org/tip/7859e404ae73fe4f38b8cfc1af19ea82f153084e
Author:     John Stultz <john.stultz@xxxxxxxxxx>
AuthorDate: Fri, 22 Feb 2013 12:33:29 -0800
Committer:  John Stultz <john.stultz@xxxxxxxxxx>
CommitDate: Fri, 15 Mar 2013 16:50:20 -0700

timekeeping: Use inject_offset in warp_clock

When warping the clock (from a local time RTC), use
timekeeping_inject_offset() to atomically add the offset.

This avoids any minor time error caused by the delay between
reading the time, and then setting the adjusted time.

Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
---
 kernel/time.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/time.c b/kernel/time.c
index effac57..d3617db 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -142,9 +142,9 @@ static inline void warp_clock(void)
 		struct timespec adjust;
 
 		persistent_clock_is_local = 1;
-		adjust = current_kernel_time();
-		adjust.tv_sec += sys_tz.tz_minuteswest * 60;
-		do_settimeofday(&adjust);
+		adjust.tv_sec = sys_tz.tz_minuteswest * 60;
+		adjust.tv_nsec = 0;
+		timekeeping_inject_offset(&adjust);
 	}
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux