On Fri 28 Jun 2024 at 14:54:42 (-0400), Greg Wooledge wrote:
> > > It's not like you can say "Oh, I was asleep for 7.5234 hours, so I need
> > > to adjust the HW clock time forward by X seconds because I know it runs
> > > a bit slow."  That information is not available to you.
> > 
> > It is if /etc/adjtime is set properly when you go to sleep.
> > See `hwclock(8)` or `adjtime_config(5)`.
> 
> Yeah, except... you're assuming a workflow that is not real or reliable.

That's why I wrote "It's not clear to me which NTP (protocol) packages
are set up to use the util-linux stuff, assuming you're not rolling
your own startup/shutdown scripts. (That's the problem in the Subject
line, in a sense.)"

Packages like chrony can set up a workflow that retains the clock
information and makes adjustments to the system clock (and, if
required, the RTC) as necessary.

> hobbit:~$ ls -l /etc/adjtime 
> -rw-r--r-- 1 root root 44 Mar  6 07:04 /etc/adjtime
> hobbit:~$ uptime
>  14:47:40 up 29 days,  2:54, 29 users,  load average: 1.58, 1.07, 1.15
> 
> Nothing writes to /etc/adjtime on a regular basis.  It's only written
> if you manually run an hwclock command, or if you change something
> (such as deciding to store your HW clock in UTC instead of local time,
> which is what I did on March 6 after learning that Debian had chosen
> local time when I installed).

Packages like chrony may have an upstream default to use /etc/adjtime,
but AIUI Debian's default is a private, often protected, file.

> > It is if /etc/adjtime is set properly when you go to sleep.
> 
> You cannot assume that adjtime was updated the last time your system
> stopped running, because your system might have stopped running due to
> a crash, instead of a controlled shutdown.
> 
> All of the arguments that are being constructed here are bogus.

You can track the system clock and RTC periodically, and keep the
statistics. Optionally you can also set the RTC at the same time,
but that's not necessary, and a separate decision.

> The *only* thing you know at boot time is what's in the HW clock, and
> if you're really lucky, you'll be able to figure out what time zone
> it's allegedly set to (after reading /etc/adjtime from disk).
> 
> hobbit:~$ cat /etc/adjtime
> 0.000000 1708191089 0.000000
> 1708191089
> UTC
> hobbit:~$ date -d @1708191089
> Sat Feb 17 12:31:29 EST 2024

I don't think you've mentioned which package(s) you're using to
control your system clock.

Cheers,
David.

Reply via email to