fake-hwclock

Prevent system clock from going backward at startup

sudo fake-hwclock save|load [force]

save system clock to file with time later than fake-hwclock's release date.
With force saves any time.
load Slew the system clock forward to the time in the file.
With force move the system clock backwards or forwards.

Files

file to store the time /etc/fake-hwclock.data
2021-10-06 17:17:01
UTC
init script
run on startup and shutdown
/etc/init.d/fake-hwclock
NB fake-hwclock exits after save or load so invoking init script with
start does a load and
stop|reload|restart|force-reload actually issues a save
systemd service to run on startup and shutdown /lib/systemd/system/fake-hwclock.service
Settings file for the init script. /etc/default/fake-hwclock (Only comments)
Cron job saves hourly /etc/cron.hourly/fake-hwclock

For systems that may have power reset randomly it may be wise to add a root cron entry to save more frequently, otherwise during startup the system it may be 59+ minutes slow until an ntp server can be contacted.

Environment $VARIABLES

set the file used by fake-hwclock $FILE

Errors

> sudo fake-hwclock load
Current system time: 2021-10-06 17:46:43     UTC
fake-hwclock saved clock information is in the past: 2021-10-06 17:17:0
To set system time to this saved clock anyway, use "force"
$? = 0

Return values

invalid command 1
Permission denied 2