[PATCH] timekeeping: avoid adjust kernel time once hwclock kept inUTC time
From: Dong Zhu
Date: Thu Dec 06 2012 - 08:45:00 EST
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>
---
kernel/time.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/time.c b/kernel/time.c
index d226c6a..0b592ce 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -134,9 +134,11 @@ static inline void warp_clock(void)
{
struct timespec adjust;
- adjust = current_kernel_time();
- adjust.tv_sec += sys_tz.tz_minuteswest * 60;
- do_settimeofday(&adjust);
+ if (sys_tz.tz_minuteswest) {
+ adjust = current_kernel_time();
+ adjust.tv_sec += sys_tz.tz_minuteswest * 60;
+ do_settimeofday(&adjust);
+ }
}
/*
--
1.7.11.7
--
Best Regards,
Dong Zhu
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/