I have a confession to make :-) For years I faced the annoyance that my laptop would not follow the one-hour timeshift when the Daylight Saving Time would change from Summer- to Wintertime or back. I had to manually fix the time for years. My servers are fine always. I never took the time to find the root cause and fix this.
Today I had enough of it and dug into the issue until I found the root cause.

So what is happening?

My laptop’s hardware clock (RTC) is set to localtime instead of UTC. Combine that with the laptop being switched off (and not using NTP) when the DST switch happens and you get my symptoms. How is that?

The RTC only stores a wall-clock value. It has no idea whether that value is CEST or CET. Slackware tracks how to read it in /etc/hardwareclock, which says either "UTC" or "localtime". In localtime mode, rc.S reads the RTC at boot with hwclock --hctosys --localtime, and rc.6 writes the system time back with --systohc at shutdown.

And that results in roughly these events happening this weekend:

  • Saturday 22:00 CEST: I shut down the laptop. The rc.6 script writes “22:00” into the RTC. That means 20:00 UTC.
  • DST switches from Summer- to Wintertime while I am sleeping and the laptop is off.
  • Sunday morning: The laptop is still off but the RTC is battery-powered and has kept ticking. It would show, say, “10:17”. It is still counting in CEST, so that is really 08:17 UTC, which is 09:17 CET.
  • I pour coffee and boot the laptop: hwclock asks the timezone database how to read “10:17” today. The answer is CET (UTC+1), so it sets the kernel to 09:17 UTC.
  • Result: the system clock is now off by an hour in UTC. It displays 10:17 CET while the real time is 09:17 CET.

In spring the same thing happens in the other direction, and the laptop ends up an hour behind. Then - like every time - I correct it by hand, the corrected value gets written to the RTC at the next shutdown, and the mistake is baked in for another six months.

Why is my server not suffering the same fate? Any one of the following would be enough, but my LAN server runs an NTP daemon and is never powered down:

  • Its RTC is set to UTC, so a stored value means the same thing at any time of year.
  • The machine runs ntpd, which corrects the clock after boot anyway.
  • It is not powered off, but instead keeps running through the DST switch. When it is running, the kernel handles DST through the zone file, and the next shutdown writes a correct local value.

A laptop is then of course the worst case: it is often powered off over the weekend of the switch, and it often has no NTP running at boot either.

To fix this:

  1. First, correct the system clock (the laptop must have internet connectivity)
    # ntpdate pool.ntp.org
  2. Write the now-correct time to the RTC, as UTC
    # hwclock --systohc --utc
  3. Tell Slackware's 'rc.S' and 'rc.6' scripts to treat the RTC as UTC from now on
    # echo "UTC" > /etc/hardwareclock

You can then verify the result: a "date -u" command should match the real UTC calue and hwclock should agree:
# date; date -u; hwclock --show

The order matters. If you write the RTC before correcting the system clock, you store the wrong hour, just in UTC this time. The command 'hwclock --utc' also updates the last line of '/etc/adjtime', so hwclock itself and Slackware’s /etc/hardwareclock will agree.

An additional detail to fix: my laptop's time was a few minutes off to start with. This drift happens naturally over time when your computer does not sync to an atomic clock from time to time. To keep the drift away, I enabled the NTP daemon and configured it properly.
Add these two lines to /etc/ntp.conf:

pool pool.ntp.org iburst
restrict source nomodify notrap noquery

Make the rc script executable and start it manually (on next boot, Slackware will do that for you):
# chmod +x /etc/rc.d/rc.ntpd
# /etc/rc.d/rc.ntpd start

Wait a few minutes and then use the 'ntpq' command to verify that your local NTP daemon is syncing with an online timeserver:

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 europe.pool.ntp .POOL.          16 p    -   64    0    0.000   +0.000   0.000
*mc02.root.proje 124.216.164.14   2 u   40   64    1   23.229   -2.486   4.368
+82.67.200.13    192.168.6.8      3 u   39   64    1   38.737   -2.392   3.693
+172-232-208-229 80.192.165.246   2 u   43   64    1   35.452   -7.052   4.751
+178.239.19.57 ( 10.1.105.4       2 u   42   64    1   26.853   +0.143   2.254

The line prefixed with an asterisk '*' shows the actual server your local daemon is syncing to; the ones prefixed with the plus sign '+' are considered good candidates to switch to when needed.

Note that the '/etc/ntp.conf' file in Slackware does not have 'pool' examples, only 'server' examples. You really want to configure a pool of timeservers in order to be resilient against outages. The two lines shown above are essential additions to this file; you don't have to edit anything else.

I learnt something this morning that I should have learnt a long time ago... I hope it helps other people who visit here in future, looking for answers to the same question.