time-util: improve detection of synchronized clock
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 1 Aug 2019 09:47:18 +0000 (11:47 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 1 Aug 2019 15:32:36 +0000 (17:32 +0200)
commitbca5a0eaccc849a669b4279e4bfcc6507083a07b
tree696e048a24de913fd1a600e8eb349cb01f1ccf6e
parent1888e5bec63811062262d295bc134b9ed50eb44a
time-util: improve detection of synchronized clock

Instead of checking for the STA_UNSYNC flag in the timex status, check
the maximum error. It is updated by the kernel, increasing at a rate of
500 ppm. The maximum value is 16 seconds, which triggers the STA_UNSYNC
flag.

This follows timedatex and allows timedated to correctly detect a clock
synchronized by chronyd when configured to not synchronize the RTC.
src/basic/time-util.c