aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDong Zhu <bluezhudong@gmail.com>2012-12-06 09:03:34 -0500
committerJohn Stultz <john.stultz@linaro.org>2013-03-15 19:50:12 -0400
commitc30bd09915ea243603d7803d53de890c4a6f1474 (patch)
tree83223e29cf442b17874e3a343b05f3bff8e86eb5
parent7c6baa304b841673d3a55ea4fcf9a5cbf7a1674b (diff)
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@gmail.com> [jstultz: Updated to merge with conflicting changes ] Signed-off-by: John Stultz <john.stultz@linaro.org>
-rw-r--r--kernel/time.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/time.c b/kernel/time.c
index f8342a41efa6..effac571589f 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -138,13 +138,14 @@ int persistent_clock_is_local;
138 */ 138 */
139static inline void warp_clock(void) 139static inline void warp_clock(void)
140{ 140{
141 struct timespec adjust; 141 if (sys_tz.tz_minuteswest != 0) {
142 struct timespec adjust;
142 143
143 adjust = current_kernel_time();
144 if (sys_tz.tz_minuteswest != 0)
145 persistent_clock_is_local = 1; 144 persistent_clock_is_local = 1;
146 adjust.tv_sec += sys_tz.tz_minuteswest * 60; 145 adjust = current_kernel_time();
147 do_settimeofday(&adjust); 146 adjust.tv_sec += sys_tz.tz_minuteswest * 60;
147 do_settimeofday(&adjust);
148 }
148} 149}
149 150
150/* 151/*