Web lists-archives.com

Re: Correct: System Thinks Hardware Clock is UTC




On Sun, 20 May 2018 21:59:08 +0100 Steve McIntyre said:

> The code in the Debian installer that deals with this [1] is:

I have been wondering where this is set during installation. Thanks for the
pointer.

> If you're using systemd, then /etc/default/rcS is not likely to do
> much. However, you may want to check in /etc/adjtime. My machine has
> the following:
> 
> 0.000000 1521991744 0.000000
> 1521991744
> UTC
> 
> If yours is saying "UTC" there, then try "LOCAL" instead.
> 
> HTH!
> 
> [1]
> https://salsa.debian.org/installer-team/clock-setup/blob/master/finish-install.d/10clock-setup#L118

According to hwclock(8);

"A third method is to delete the /etc/adjtime file. Hwclock will then default
to using the UTC timescale for the Hardware Clock. If the Hardware Clock is
ticking local time it will need to be defined in the file. This can be done by
calling hwclock --localtime --adjust; when the file is not present this command
will not actually adjust the Clock, but it will create the file with local time
configured, and a drift factor of zero."

Therefore, if /etc/adjtime is missing (as in my system) that means hardware
clock is set to UTC with zero drift factor. With drift adjusting left to NTP,
there should be no need to set drift factor in /etc/adjtime, leaving "LOCAL"
setting the only plausible reason for it to exist.

BTW --adjust seems to record a drift ratio, so --set might be more appropriate
if drift ratio setting is not wanted. Better to test both options separately
(with a missing /etc/adjtime as a starting point) and see the resulting adjtime
(according to "The Adjtime File" explanation, first field in the first line is
the drift ratio).

In "The Adjust Function" explanation it says:
"Suppose you start with no adjtime file. You issue a hwclock --set command to
set the Hardware Clock to the true current time. hwclock creates the adjtime
file and records in it the current time as the last time the clock was
calibrated."

As for your setup, according to the same man page, your drift rate is zero
(default) and hw clock set to UTC (default), so you could have
removed /etc/adjtime (i.e. rename) just as well, with the same end result.

Regards
-- 
Abdullah Ramazanoğlu