Discussion:
[chrony-users] Notification from Chrony about change in time
Jahagirdar, Bhushan
2016-10-03 09:30:49 UTC
Permalink
Hi,

Is there any way to know if Chrony has updated the system time? I mean an interface, event or a possibility of a callback from Chrony.

--
Thanks and Regards,
Bhushan J.
Bill Unruh
2016-10-03 10:08:22 UTC
Permalink
NOt sure what you mean. Chrony constantly updates the time. It is not
something that happens at any particular time. It measures how far out the
time now is, then adjusts the rate of the clock so that that time difference
will be eliminated over some time period. That is a constant process.

chronyc will tell you various things, including what the current offset is,
what the adjusted rate is, etc. I think you are confused about how chrony
works. I is not like rdate, or ntpdate which simply resets the clock when run.



William G. Unruh __| Canadian Institute for|____ Tel: +1(604)822-3273
Physics&Astronomy _|___ Advanced Research _|____ Fax: +1(604)822-5324
UBC, Vancouver,BC _|_ Program in Cosmology |____ ***@physics.ubc.ca
Canada V6T 1Z1 ____|____ and Gravity ______|_ www.theory.physics.ubc.ca/
Post by Jahagirdar, Bhushan
Hi,
 
Is there any way to know if Chrony has updated the system time? I mean an interface, event or a
possibility of a callback from Chrony.
 
--
Thanks and Regards,
Bhushan J.
 
Miroslav Lichvar
2016-10-04 09:13:45 UTC
Permalink
Post by Jahagirdar, Bhushan
Hi,
Is there any way to know if Chrony has updated the system time? I mean an interface, event or a possibility of a callback from Chrony.
Are you interested in all adjustments of the clock or only some of
them like steps or slews largers than some threshold?

The only possibility of a real callback is the mailonchange directive,
which sends email when an adjustement reached a threshold. You could
use the --with-sendmail option to compile chronyd with a different
path to the sendmail binary in order to execute any binary or script
you need.

There might be other possibilities depending on what adjustments you
need to detect:
- monitor the tracking log for new entries
- periodically check the chronyc tracking output
- periodically check the reference timestamp of chronyd operating as
an NTP server

If you need to detect steps only, on Linux you could write a small C
program which creates a timer with infinite timeout and the
TFD_TIMER_CANCEL_ON_SET flag, which will expire when the clock is
stepped by any daemon.
--
Miroslav Lichvar
--
To unsubscribe email chrony-users-***@chrony.tuxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-***@chrony.tuxfamily.org
with "help" in the subject.
Trouble? Email ***@chrony.tuxfamily.org.
Loading...