Re: [chrony-users] Indication / notification that chrony is synched with an ntp source successfully using chronyc

2019-10-22 Thread Bill Unruh




Hi all

We are having an embedded system with linux running on it. The device has 
several interfaces to go online (e.g. ethernet ports or a modem).
So it could take quite a while until the device has an internet connection. 
Also we have to start some daemons at startup of the system to
bring the device online.

We configured chrony to do a step, if the difference between the system clock 
and the ntp-time is greater than 1 second, but only for the
first three synchronizations:
makestep 1.0 3



do a burst after this. The burst should get the system ontime and vary
roughly on speed so additional makesteps would not be needed. 
And burst is well timed with an interval of 1 second I believe. Thus after a

bit over 4 sec the clock should

burtst 3/5 say


If we understood it correctly, we don't have to expect another time step when 
this 3 synchronizations have been done successfully - is that
corrrect?


Assuming the burst works and the remote machine is not down or disconnected or
whatever.


At this point we then would restart all the daemons to ensure the time step did 
not lead to any malfunctions in these daemons.

Is it somehow possible to know from outside (e.g. using chronyc or reading log 
files, etc) when chrony has done with these 3 first
synchronozations? We didn't see an onbvious possibility using chronyc to gather 
such an information.

Best Regards & many thanks in advance for your help
Phil





--
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.

Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Indication / notification that chrony is synched with an ntp source successfully using chronyc

2019-10-22 Thread Miroslav Lichvar
On Tue, Oct 22, 2019 at 01:30:52PM +, Philipp Hofstetter wrote:
> If we somehow could recognize that there was a time correction with a bigger 
> value than the one configured in the makestep config (1s in our case), we 
> would then know that there was a time step and react appropriately (e.g. 
> restart our daemons). That is then independent of the number of time 
> synchronizations configured for makestep.
> 
> Could the tracking log be used to see that information? Does column 7 ("The 
> estimated local offset at the epoch..") or column 11 ("The remaining offset 
> correction from the previous update") hold that information?

The difference between column 7 and 11 is the value that's compared
with the step threshold.

>From the code:
fabs(offset - offset_correction) > make_step_threshold

The values in the log are rounded, so you may want to compare it with
a slightly smaller value (e.g. 0.999), to avoid false negatives.

-- 
Miroslav Lichvar


--
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Indication / notification that chrony is synched with an ntp source successfully using chronyc

2019-10-22 Thread Miroslav Lichvar
On Tue, Oct 22, 2019 at 12:21:56PM +, Philipp Hofstetter wrote:
> We configured chrony to do a step, if the difference between the system clock 
> and the ntp-time is greater than 1 second, but only for the first three 
> synchronizations:
> makestep 1.0 3
> 
> If we understood it correctly, we don't have to expect another time step when 
> this 3 synchronizations have been done successfully - is that corrrect?

Yes.

> Is it somehow possible to know from outside (e.g. using chronyc or reading 
> log files, etc) when chrony has done with these 3 first synchronozations? We 
> didn't see an onbvious possibility using chronyc to gather such an 
> information.

One possibility would be to count how many times has changed the
"Ref time" field in chronyc tracking, e.g. repeating the command once
per second.

If you changed the number of updates in makestep from 3 to 1, you
could just check if the Reference ID is not 0.0.0.0, or use the
chronyc waitsync command.

Another possibility is to enable the tracking log and count lines that
don't have the 0.0.0.0 IP address.

-- 
Miroslav Lichvar


--
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.