[tip:timers/core] timekeeping: Avoid adjust kernel time once hwclock kept in UTC time

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

 



Commit-ID:  c30bd09915ea243603d7803d53de890c4a6f1474
Gitweb:     http://git.kernel.org/tip/c30bd09915ea243603d7803d53de890c4a6f1474
Author:     Dong Zhu <bluezhudong@xxxxxxxxx>
AuthorDate: Thu, 6 Dec 2012 22:03:34 +0800
Committer:  John Stultz <john.stultz@xxxxxxxxxx>
CommitDate: Fri, 15 Mar 2013 16:50:12 -0700

timekeeping: Avoid adjust kernel time once hwclock kept in UTC time

If the Hardware Clock kept in local time,kernel will adjust the time
to be UTC time.But if Hardware Clock kept in UTC time,system will make
a dummy settimeofday call first (sys_tz.tz_minuteswest = 0) to make sure
the time is not shifted,so at this point I think maybe it is not necessary
to set the kernel time once the sys_tz.tz_minuteswest is zero.

Signed-off-by: Dong Zhu <bluezhudong@xxxxxxxxx>
[jstultz: Updated to merge with conflicting changes ]
Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
---
 kernel/time.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/kernel/time.c b/kernel/time.c
index f8342a4..effac57 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -138,13 +138,14 @@ int persistent_clock_is_local;
  */
 static inline void warp_clock(void)
 {
-	struct timespec adjust;
+	if (sys_tz.tz_minuteswest != 0) {
+		struct timespec adjust;
 
-	adjust = current_kernel_time();
-	if (sys_tz.tz_minuteswest != 0)
 		persistent_clock_is_local = 1;
-	adjust.tv_sec += sys_tz.tz_minuteswest * 60;
-	do_settimeofday(&adjust);
+		adjust = current_kernel_time();
+		adjust.tv_sec += sys_tz.tz_minuteswest * 60;
+		do_settimeofday(&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