Re: How to use /etc/adjtime
On Fri, Jun 28, 2024 at 14:44:03 -0500, David Wright wrote:
> On Fri 28 Jun 2024 at 14:54:42 (-0400), Greg Wooledge wrote:
> > 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.
I'm using ntpsec.
On Fri, Jun 28, 2024 at 15:53:03 -0400, Stefan Monnier wrote:
> Notice I wrote "sleep". I'm concerned about the suspend+wakeup case,
> not the case when you're booting up.
> [ I thought I'd made it abundantly clear. ]
I'm not a laptop person. I don't know how to fix laptop-specific issues.
And I'm pretty convinced this is a highly laptop-specific issue, disguised
as a question about /etc/adjtime. An X-Y problem, for sure.
If I'm understanding correctly, the problem you want to solve is as
follows:
1) You are using a laptop.
2) Your laptop's hardware clock drifts quite notably.
3) At times, you perform a "sleep" or "suspend" or whatever it's called.
This period of not-running-but-not-shut-down-either lasts for long
enough that your clock drift becomes severe.
4) Apparently, the system clock does not advance while in this state.
5) After going from the not-running state to the running state, your
system clock is reinitialized from the hardware clock. Which is
not accurate enough for your purposes.
6) After going from the not-running state to the running state, your
NTP daemon does not perform a clock synchronization soon enough for
your purposes. User programs have already begun to run. Or continue
to run? I have absolutely no idea what goes on here.
Now, for some reason, you have become fixated on the /etc/adjtime file,
which may or may not be an appropriate way to mitigate the problem.
I have doubts.
It sounds like whatever least-bad solution you end up using is going to
depend on which NTP daemon you use, and will involve configuration
thereof. It will not be something generic to adjtime_config(5) or
hwclock(8) or util-linux. It also won't be something generic to Debian
systems as a whole, because neither servers nor traditional desktop
computers have this issue. It's a laptop issue.
David has said that chrony can do fancy things involving the hardware
clock. Maybe you should investigate that solution path.
Reply to: