Re: Question about chrony use in a system without RTC battery

Kris van Rens <[email protected]>
Newsgroups gmane.comp.time.chrony.user
Message-ID <CAGSxEQFHy=8E_N8FKSti43VcjmFGk4XA8P1u7+0CJMrMwFr9bw@mail.gmail.com>
Hi Bill,

Thanks for the suggestions.

On Thu, Mar 10, 2022 at 6:37 PM Bill Unruh <[email protected]> wrote:
>
> Why not just use the prodedure that both Miroslav and I suggested-- run a cron
> job once a minute to touch /var/log/chrony.drift. That should be pretty
> reasonable even if the internet went down for a couple of hours before the
> power outage. Most of the computer clocks do pretty well freewheeling, so that
> time should not be too far out  (less than a second and certainly not fast by
> a minute ) for use when chrony comes back up again and the internet comes up
> at powerup so that the count is progressive. I would also make sure that that
> program which dies if the time ever goes backwards  starts up a few minutes
> after chrony comes up again.

Yeah this is what I've implemented. At early boot time (pre-chronyd)
correct the time to last-known-good if the RTC is behind system time
(assuming RTC always falls back). Then, aside from NTP
synchronization, on a regular basis update last-known-good time. I
must say it works quite well.

I did have to fiddle with the "system time provider" in my tool,
because during the lifetime of chronyd, /dev/rtc is unavailable for
reading. So during the early boot time correction I'm using the RTC
from /dev/rtc, then, for runtime last-known-good time updating, I'm
using the system-wide date/time as the system time.

> Note also since your program presumably writes out files, you could use the
> timestamp on those files instead of chrony.drift as the source for you time at
> bootup.

Yes, I'm using the timestamp of a custom file dedicated for this purpose.

Thanks for all the great help!

Met vriendelijke groeten / Kind regards,

Kris van Rens

-- 
To unsubscribe email chrony-users-request-kWFZVVI9zxvPqho9SqqRMmD2FQJk+8+b@public.gmane.org 
with "unsubscribe" in the subject.
For help email chrony-users-request-kWFZVVI9zxvPqho9SqqRMmD2FQJk+8+b@public.gmane.org 
with "help" in the subject.
Trouble?  Email [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.