xanmanning / alarm-fake-hwclock

Fake HWClock script for RPi Arch Linux Arm (replicates Raspbian's fake-hwclock)
Other
36 stars 11 forks source link

Added maximum time difference on trusting clock #5

Closed ludocode closed 7 years ago

ludocode commented 7 years ago

If the hardware clock is off by more than the threshold (currently set to ten years), we assume the hardware clock is broken and reset it.

This is for devices that reset the clock to a far future date when they lose power. For example when my Acer C720 Chromebook runs out of battery, the kernel fails to read the system time on the next startup and leaves the clock at the year 2151. The current version of fake-hwclock assumes it's correct because it's in the future (and stores 2151 instead of resetting it.) This change resets the clock to the last known time instead since it's more than ten years off.