On Thu 27 Jun 2024 at 12:48:03 (-0400), Stefan Monnier wrote: > I have a machine whose RTC clock is drifting significantly and it is > often suspended for several days. I run NTP so the drift I see when > I wake the machine up gets fixed by "stepping" the clock after a while, > but that can take a while and I'd like to improve this > intermediate situation.
Do you really run ntp? You might already be running ntpsec, its replacement. > The /etc/adjtime is supposed to be there for such purposes but it seems > to be mostly unused: I assume its "UTC" setting is respected but the > first and second lines indicate it has not been updated since 2015 > (i.e. when that Debian install was used in another machine). You might find your clock drift in /var/lib/ntpsec/ntp.drift or wherever /etc/ntpsec/ntp.conf specifies it. > I have two questions: > > - How can I get Debian to use this file when waking up the machine from > suspend (which would presumably change the file by updating the first > line's "last adjust time")? > > - How can I get `ntpd` to adjust the first line's "drift factor" when it > steps the clock? > > The second question is less important (I can write the drift factor by > hand, e.g. in case `ntpd` is not being told when the clock is (re)set > based on the RTC, making it impossible for it to compute a drift factor). I don't know how to speed up correcting the clock as I use chrony, but ntpsec may have similar directives available. Cheers, David.