hwclock, rtcwake, /etc/adjtime
Paul Fox
pgf at laptop.org
Fri Aug 21 20:47:07 UTC 2009
executive summary: we need to make sure that /etc/adjtime, as
shipped, has a third line that says "UTC". alternatively, we
should add such a line on first boot.
having already written all this out for myself, to be sure i
understand it, i'll share:
- the third line in /etc/adjtime specifies whether the
RTC is maintained in localtime or UTC. most unix
systems maintain the RTC in UTC.
- hwclock needs (and maintains) the third line, because
hwclock can set the system time from the RTC, and
vice-versa. if there's no third line, hwclock assumes
the RTC is maintained in localtime. (this surprises me,
but i think it's always been true.) hwclock will
add a third line if it's missing, and the added line
will say "LOCAL".
- rtcwake needs the third line, because it uses the RTC to
wake up the system at a given time in the future. if
rtcwake finds no third line in /etc/adjtime, it assumes UTC.
please note the irony that hwclock and rtcwake are both
provided by the same package (util-linux-ng).
- rtcwake has a bug with regard to daylight savings time
which only shows up if it thinks the RTC is in maintained
in localtime. the bug causes wakeup times to be wrong by
at least an hour.
- when an XO boots for the first time, the /etc/adjtime file
provided by the initscripts package has no third line.
- hwclock is run by /etc/init.d/halt when the system is
shutdown cleanly, at which point /etc/adjtime will
have it's third line created, to say "LOCAL".
- XO laptops have their RTC set to UTC at the factory.
the upshot of all this is that on initial boot of an XO,
rtcwake will work fine, and after the first shutdown, it will
not. i'm sure there are also implications for the system
time and date, and the system timezone. but i haven't thought
about those issues much.
anyway, i think it can all be fixed by shipping a complete
/etc/adjtime file.
paul
=---------------------
paul fox, pgf at laptop.org
More information about the Fedora-olpc-list
mailing list