Re: [chrony-users] Discover when a time sync has been performed

[ Thread Index | Date Index | More Archives ]

On Thu, Jul 04, 2013 at 12:32:10PM +0200, Ignacio Verona Ríos wrote:
> My question is about checking when a time sync has been performed. I'm
> developing an application where time sync is important. It's running on a
> Raspberry Pi, so time is not very good kept. When the net connection is
> started I notify chrony about the sources being online, and the config is
> set to execute a "makestep" if more than 10secs deviation is found.
> But, how may I check if the sycn (makestep) is already done? I've been
> searching the logs (syslog, tracking, measurements) but don't know what may
> trigger my "Sync ok!" event.

If the measured offset is larger than the makestep limit, chronyd will
correct the error immediately. When that happens, a message is written
to the system log and there should be an entry in the tracking log
too if it's enabled.

If the offset is below the makestep limit, it will be corrected slowly
by slewing. You can monitor the remaining correction in the "System
time" field in the tracking report.

> Maybe looking at the offset value and setting some threshold, so if it's
> lower it's ok for the app to continue?

It depends on what exactly you want to check. You can use the chronyc
waitsync command, it waits for the remaining correction (and
optionally also for the skew) to be smaller than a specified limit.

If you need also to be sure that an update was actually performed
after the sources were set online, you will need to check the time
stamps in tracking log or check if the Ref time field in the tracking
report has changed.

Does this answer your question?

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+