]> git.ipfire.org Git - thirdparty/chrony.git/commit
rtc: more reliable method of reading rtc for initial trim
authorHattink, Tjalling [FINT] <T.Hattink@fugro.nl>
Wed, 28 May 2014 11:54:27 +0000 (13:54 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 2 Jun 2014 14:15:17 +0000 (16:15 +0200)
commit2ed9853bcc6a2e75749dd8a8153cdfb9efd8b236
tree4800f1dcb56f544efcab00a901b23bd57c2b049c
parent26e00ffbeb608f43106fec96c94629dbe74e87fd
rtc: more reliable method of reading rtc for initial trim

When chrony reads in the linux rtc for the first time to trim the system
clock, it only reads it once. As it is possible that the rtc updates
itself during the read operation, the reported rtc time could be false.
To prevent this I've added a loop that reads the rtc clock twice, if the
seconds do not match retry the two read operations. If they match you
can assume the read operation was successful.

This is based on the hwclock implementation of reading the rtc clock
from the util-linux package.
rtc_linux.c