Re: [chrony-dev] [RFC] Transparent fallback from NTP reference clock to RTC |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-dev] [RFC] Transparent fallback from NTP reference clock to RTC
- From: Miroslav Lichvar <mlichvar@xxxxxxxxxx>
- Date: Mon, 7 Apr 2025 16:52:17 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744037547; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=l+wDUz4wlx3yIwFScBncAoJpryngViTphNBD/Av2dLg=; b=Qbdmewal3a3/nkMUbM3IcEY20THygWekHuaHj3KdCZZ1FI3FTaSLOtz1tS1Pf83V71D92I vfcWVjymZQgr2uVH2wvOoSaTg2oYpdC7ak1bUZYh4qvMyH72yqRvM++HvbqDU0aYReAi+5 hEVDtO8m84y7qAbJDe4HLYX83/tNGqM=
On Mon, Mar 31, 2025 at 05:38:11PM +0200, Ahmad Fatoum wrote:
> > I.e. use it only for stabilization of the system clock, not as a time
> > source. That would work even when it's synchronizing to NTP servers.
> > When NTP is not reachable, it would activate the local reference as
> > configured by the local directive. I guess something would be needed
> > for the case when it's started without NTP.
>
> Do you have a suggestion how to go about it?
Try it with this patch:
--- a/refclock.c
+++ b/refclock.c
@@ -732,7 +732,13 @@
SST_Stats stats = SRC_GetSourcestats(inst->source);
if (SST_Samples(stats) < SST_GetMinSamples(stats)) {
+#if 0
UTI_ZeroTimespec(ref);
+#else
+ LCL_ReadCookedTime(ref, NULL);
+ *freq = 0.0;
+ *offset = 0.0;
+#endif
return;
}
That should force the first adjustment to accumulate the "local"
refclock's frequency offset and track it closely until a time source
is selected. I suspect there could be numerical errors accumulating
over long periods of time, but insignificant when compared to a real
time source like RTC.
It could be a new option, if I can get a name for it.
> I also think that even if
> local works for us, we still need to address the synchronization of the
> RTC to system time when the system is NTP-synchronized.
>
> Currently, chrony disallows rtc reference clock to co-exist with
> rtcsync, but maybe we should allow it and enable the rtcsync only when
> NTP is reachable and the RTC is local and not activated?
rtcsync cannot work. That's the kernel doing changes at random times
unknown to chronyd. I think it could work with rtcfile if it shared
the descriptor and timestamps with the refclock driver.
--
Miroslav Lichvar
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble? Email listmaster@xxxxxxxxxxxxxxxxxxxx.