[Voyage-linux] alix without hardware clock - saving/restore time on reboot

Przemysław Matejko (spam-protected)
Thu Jan 19 20:34:11 HKT 2012


Hi
Does Voyage Linux supports boards without hardware clock (I have
alix2c2)? I mean, if it provides "software clock" script or similar?
For example, in Gentoo Linux there is a 'swclock' script (in
baselayout-2) which writes system time during shutdown to file and
restore it from file during startup - when you reboot device, there is
only a few seconds clock drift, instead of years; also, this prevents
problems with some programs which check date of files ("file from the
future" error), when ntp server is out of sync.
If there is no script like that, I have an idea how to do it:
- saving time (filesystem must be rw; command must be invoked as late
as possible on shutdown):

date +%m%d%H%M%Y.%S > /place/where/we/write/time

- restore time (filesystem can be ro; command must be invoked as early
as possible on startup):

date $(cat  /place/where/we/write/time)

I tested these commands on running system and it seems that the
commands work, but I'm not sure where it should be added into init
scripts.
Anyway, I think it's good Idea to add regular init script like that
(if there is no any) to repositories - after all, Voyage Linux is
dedicated system for alix devices (most of them doesn't have hardware
clock, not only mine).




More information about the Voyage-linux mailing list