Re: [chrony-dev] [RFC] Transparent fallback from NTP reference clock to RTC

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


Hello Miroslav,

On 7/2/25 14:37, Miroslav Lichvar wrote:
> On Tue, Jul 01, 2025 at 03:25:29PM +0200, Ahmad Fatoum wrote:
>> On 4/7/25 16:52, Miroslav Lichvar wrote:
>>> 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 called it bootstraptime and included it in merge request #27, which I
>> submitted today.
> 
> Ok, thanks. I'll have a look.
> 
>>> 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.
>>
>> AFAIU, the kernel will not program the RTC while STA_UNSYNC is set and
>> I'd expect chrony to eventually clear the bit after losing NTP sync.
>>
>> This sounds like the behavior I am after: While NTP synchronized,
>> program the RTC. When all offline and RTC is local ref clock, do not
>> keep updating it with system time. Am I missing something?
> 
> chronyd does not set the STA_UNSYNC flag when it loses its upstream
> sources.

Oh. Then I have trouble understanding the code in set_sync_status, which
compares max_error against MAX_SYNC_ERROR (== 16s) as it looks like that
would cause STA_UNSYNC to be set once the threshold is exceeded.

> It still considers the clock to be synchronized, it just
> grows the estimated error over time. The kernel should still be
> copying system time to the RTC..

I am still trying to wrap my head around the implications.
But if rtcsync is indeed not salvageable for the local RTC refclock
case, I'd look into making rtcfile usable instead.

Cheers,
Ahmad


-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |


-- 
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.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/