From: John Stultz <john.stultz@linaro.org>
Date: Fri, 22 Feb 2013 20:33:29 +0000 (-0800)
Subject: timekeeping: Use inject_offset in warp_clock
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7859e404ae73fe4f38b8cfc1af19ea82f153084e;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git

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@linaro.org>
---

diff --git a/kernel/time.c b/kernel/time.c
index effac571589f..d3617dbd3dca 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);
 	}
 }