Re: [chrony-users] Chrony setup using RTC as fallback

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


On Wed, Nov 18, 2015 at 12:04:07AM +0100, Mauro Condarelli wrote:
> I have an embedded system (ARM9/Buildroot) that may or may not be connected to the Internet (usually it is, but it should work also in "detached" mode; connection may come up a long time after boot).
> 
> I need to /ensure/ dates are strictly monotonic; no "jump back" larger then one second should be allowed.
> 
> The system is equipped with an RTC performing reasonably well.
> 
> My current configuration is as follows (see below), but it doesn't seem to work very well: sometimes, even if connected, it takes several minutes to switch from "default" date (Jan 2007) to the correct one.

That sounds like initstepslew didn't work (maybe chronyd was started
before network was up?), and it took 3 polls at 64s interval before
the clock was updated.

My recommendation would be to drop the initstepslew directive and
instead use the burst command when the network is up.

> In general workflow at boot should be as follows:
> 
> 1) boot (obviously ;) )
> 2) read sysclock from RTC (ASAP! before network connection goes up)
> 3) read last recorded time and, IF later than sysclock THEN sysclock = last recorded time + 1sec.

The -s option should do 2) and 3). (although there is no +1 sec added
to the recorded time).

> 4) wait for network to go up
> 5) sync time THEN
> 5.1) IF net time > sysclock THEN sysclock = net time
> 5.2) IF net time < sysclock THEN slow sysclock TILL sysclock == net time

chronyd has only one step threshold for both directions, so you would
probably need to remove the makestep directive from the config and do
that step manually in the "up" script instead. E.g.

chronyc online
chronyc burst 4/4
sleep 10
chronyc tracking | grep -q 'System time.*slow' && chronyc makestep

> At shutdown time sysclock should be saved.

When chronyd exits it touches the driftfile.

-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx 
with "unsubscribe" in the subject.
For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx 
with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


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