diff options
author | John Stultz <john.stultz@linaro.org> | 2013-02-22 15:33:29 -0500 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2013-03-15 19:50:20 -0400 |
commit | 7859e404ae73fe4f38b8cfc1af19ea82f153084e (patch) | |
tree | 444947336576e1b01dd891273865ba8ec5b2ad5f /kernel/time.c | |
parent | c30bd09915ea243603d7803d53de890c4a6f1474 (diff) |
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>
Diffstat (limited to 'kernel/time.c')
-rw-r--r-- | kernel/time.c | 6 |
1 files changed, 3 insertions, 3 deletions
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) | |||
142 | struct timespec adjust; | 142 | struct timespec adjust; |
143 | 143 | ||
144 | persistent_clock_is_local = 1; | 144 | persistent_clock_is_local = 1; |
145 | adjust = current_kernel_time(); | 145 | adjust.tv_sec = sys_tz.tz_minuteswest * 60; |
146 | adjust.tv_sec += sys_tz.tz_minuteswest * 60; | 146 | adjust.tv_nsec = 0; |
147 | do_settimeofday(&adjust); | 147 | timekeeping_inject_offset(&adjust); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||