[lfs-dev] Possible bug in hwclock

Pierre Labastie pierre.labastie at neuf.fr
Tue Oct 17 23:38:04 PDT 2017


Hi,

Some of the computers I use (those with Windows dual boot), have a hardware
clock set to local time. In this case, I set UTC=0 in /etc/sysconfig/clock,
and until recently, all was fine. But now, after each reboot, the system clock
is at (local time)+2h, that is, the system clock is set as if the hardware
clock were at utc (time in Western Europe with daylight saving is UTC+2).
Since ntpd is run, the system clock is back to the correct time after a few
minutes, and then everything is OK. But if I begin working to early after boot
(usually updating the system to recent updates in the book), I may have files
with a date in the future, and "make" is at lost.

Now I have tried (in case this is not evident "mardi" is "Tuesday"):
------------------
pierre at turboli:~$ cat /etc/adjtime
0.329349 1508224464 0.000000
1508224464
LOCAL
pierre at turboli:~$ date
mardi 17 octobre 2017, 09:16:08 (UTC+0200)
pierre at turboli:~$ sudo hwclock --utc
2017-10-17 11:17:04.765018+0200
pierre at turboli:~$ sudo hwclock --localtime
2017-10-17 09:17:13.327558+0200
pierre at turboli:~$ sudo hwclock --systohc
pierre at turboli:~$ sudo hwclock --hctosys
pierre at turboli:~$ date
mardi 17 octobre 2017, 09:17:33 (UTC+0200)
--------------------
So everything is OK, and I suspect the problem occurs only when "hwclock
--hctosys" is called for the first time: there is something in the man page
about a difference between first time and next times (note that I am not sure
whether it is in the kernel or in hwclock).

More tests to come, but it is a little harder to test while the boot scripts
are run.

Ah, forgot to tell: it is with SYSV. Maybe the systemd units take care of that...

Pierre


More information about the lfs-dev mailing list