Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7859e404 authored by John Stultz's avatar John Stultz
Browse files

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: default avatarJohn Stultz <john.stultz@linaro.org>
parent c30bd099
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -142,9 +142,9 @@ static inline void warp_clock(void)
		struct timespec adjust;

		persistent_clock_is_local = 1;
		adjust = current_kernel_time();
		adjust.tv_sec += sys_tz.tz_minuteswest * 60;
		do_settimeofday(&adjust);
		adjust.tv_sec = sys_tz.tz_minuteswest * 60;
		adjust.tv_nsec = 0;
		timekeeping_inject_offset(&adjust);
	}
}