summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2013-02-14 19:46:10 +0100
committerThomas Gleixner <tglx@linutronix.de>2013-02-14 19:46:10 +0100
commit9f4646d28362bc424b8a4c7d09ea1c2f1759371a (patch)
tree0ff9dc36f1ef598736725f3eb30e164128d39774 /kernel
parent86c8ead593305915729a7b67f738832764fb4ba7 (diff)
parent84e345e4e209cbe796c88fa2ad1732d7121ec100 (diff)
Merge branch 'fortglx/3.9/time' of git://git.linaro.org/people/jstultz/linux into timers/core
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time.c8
-rw-r--r--kernel/time/ntp.c8
2 files changed, 14 insertions, 2 deletions
diff --git a/kernel/time.c b/kernel/time.c
index d226c6a3fd2..c2a27dd9314 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -115,6 +115,12 @@ SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv,
}
/*
+ * Indicates if there is an offset between the system clock and the hardware
+ * clock/persistent clock/rtc.
+ */
+int persistent_clock_is_local;
+
+/*
* Adjust the time obtained from the CMOS to be UTC time instead of
* local time.
*
@@ -135,6 +141,8 @@ static inline void warp_clock(void)
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);
}
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 313b161504b..b10a42bb016 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -511,13 +511,17 @@ static void sync_cmos_clock(struct work_struct *work)
getnstimeofday(&now);
if (abs(now.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2) {
+ struct timespec adjust = now;
+
fail = -ENODEV;
+ if (persistent_clock_is_local)
+ adjust.tv_sec -= (sys_tz.tz_minuteswest * 60);
#ifdef CONFIG_GENERIC_CMOS_UPDATE
- fail = update_persistent_clock(now);
+ fail = update_persistent_clock(adjust);
#endif
#ifdef CONFIG_RTC_SYSTOHC
if (fail == -ENODEV)
- fail = rtc_set_ntp_time(now);
+ fail = rtc_set_ntp_time(adjust);
#endif
}