]> git.ipfire.org Git - thirdparty/chrony.git/commit
sourcestats: handle negative elapsed time in SST_GetSelectionData()
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 24 May 2017 11:50:39 +0000 (13:50 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 26 May 2017 11:33:53 +0000 (13:33 +0200)
commit73c548ad01f6f4d633bcc52ff123b7e59d7263ee
treea4c018bf8428eb036a1ff807152678a1b4aea979
parent82203e12c811fa32168f12c128e5d641fb62b5b9
sourcestats: handle negative elapsed time in SST_GetSelectionData()

Source selection uses the last event time as current time. If it was
called from a refclock which generates a sample in its poll function
(e.g. PHC), the sample time may be later than the event time. This
gives a negative elapsed time in SST_GetSelectionData() and possibly
also a negative root distance, which causes the source to be rejected as
a falseticker.

Use absolute value of the difference in order to always get a positive
root distance.
sourcestats.c