|Re: [chrony-users] Does Chronyd update the hardware clock?|
[ Thread Index |
| More chrony.tuxfamily.org/chrony-users Archives
On Tue, 10 Jun 2014, Joe M wrote:
I am trying to figure out if Chronyd updates the hardware clock.
It can (writertc is the command in chronyc) but in general it does not. It
measures the time and rate of the hardware clock in order to better use it to
set the time next time the computer is switched on. Mind you, the rate is
deternined while the computer is hot, while the error due to the rate not
being equal to 1 sec/sec occurs while the computer is off and cold, and thus
the rate difference then is different from when it is hot. But the process is
better than nothing.
My shutdown scripts have a script that sets the hwclock from the
system clock. When power loss happens, the time would be off and I
want to avoid that.
And that of course totall screws up chrony. It has no idea that you went ahead
and changed the hardware clock and thus thinks it knows what the offset and
rate is of the rtc, and it does not know it because you changed it.
So, either use the rate/offset determination of chrony and stop using hwclock
to reset the rtc, or disable the rtc in chrony and let the hwclock set the
system time on boot up.
I am thinking of having a cron job to do the "hwclock --systohc" at
frequent intervals. Not sure if Chronyd does that automatically or
not. Any thoughts, please?
Why would you want to do that? That is almost the worst of all possible
worlds. (well worse is the 11 min kernel process which resets the rtc evey 11
min to the system time if the system clock is in the "sychronized" state,
which is why chrony switches off the synchronised flag to stop that
And, also, Is there a script to show the system clock and the hwclock?
So, I can compare the time on both of these clocks.
give the system time
hwclock gives the hardware clock time. Note that rtc does not record anything
better than seconds. It does "know" what the nanoseconds are in order to turn
over the rtc exactly on the second (as it thinks it is), but you cannot get at
that information except via the interrupt that is emitted on the second.
Ie, you can know what the hardware clock is to the nearst second (well,
actually truncated second, not rounded off ) but not better. You can of course
know that the system clock is to the nearest nanosecond (well not really but
certainly microsecond-- it can be read to the nanosecond but is not accurate
to a nanosecond).
So, either keep your ( and your operating systems-- many distros have a script
which is run on shutdown which sets the rtc from the system clock) mitts off
of hwclock, and let chrony do its job, or disable chrony's handling of the rtc
and just use hwclock. Both have their advantages and disadvantages.
Note that while linux is running, the rtc (Real Time closk or hardware clock)
is not used at all. Its ONLY purpose is to set the system time at bootup.
Otherwise it is never used. So having an accurate hardware time is completely
irrelevant except at bootup.
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.