Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: Possible error in /etc/s6/sv/hwclock/down (Read 465 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

Possible error in /etc/s6/sv/hwclock/down

Hello,
I think there is a bug in the /etc/s6/sv/hwclock/down, the script is executed on system shutdown so it is supposed to save the value of the system clock to the hardware clock.

The current source code is: (taken from here)
Code: [Select]
#!/bin/execlineb -P
envfile /etc/s6/config/hwclock.conf
importas -uD "UTC" HARDWARECLOCK HARDWARECLOCK
ifelse { test $HARDWARECLOCK = UTC } { hwclock --systz --utc --noadjfile } hwclock --systz --localtime --noadjfile

The --systz option does not save anything to the hw clock (it is the option used in start), I believe both occurrencies of --systz should be replaced with --systohc, like in the runit script


Re: Possible error in /etc/s6/sv/hwclock/down

Reply #1
I realize this is an old post, but I wanted to voice my agreement that this should be changed. No wonder I have to keep manually setting the hardware time if the adjustments made by a ntp daemon are never saved!

From the hwclock man page
Quote
       --systz
           This is an alternate to the --hctosys function that does not read the Hardware Clock nor set the System Clock; consequently there is not any drift correction. It is intended to
           be used in a startup script on systems with kernels above version 2.6 where you know the System Clock has been set from the Hardware Clock by the kernel during boot.

           It does the following things that are detailed above in the --hctosys function:

           •   Corrects the System Clock timescale to UTC as needed. Only instead of accomplishing this by setting the System Clock, hwclock simply informs the kernel and it handles the
               change.

           •   Sets the kernel’s NTP '11 minute mode' timescale.

           •   Sets the kernel’s timezone.

As noted by the OP and the man pages, --systz appears to be pointless on shutdown.

Re: Possible error in /etc/s6/sv/hwclock/down

Reply #2
Thanks for bumping this one. I completely missed this report. Yes, systz is incorrect on the down script. I've just pushed the fixed version of s6-scripts to system-gremlins.