The responsibility is the “operating system”’s. How that is implemented varies.
There are two cases to consider:
If the system’s only time source is the RTC, then there’s no need to update it, except when the time is set. On Linux this is typically handled either by hwclock
, or by timedatectl
.
If the system has an external time source (over the network), the RTC should be updated. On Linux this used to be handled at shutdown (using hwclock
), but the kernel (since 3.7) can update the RTC automatically every eleven minutes if the system time is maintained using an external source and the RTC is configured appropriately.
On Linux, the kernel expects time synchonisation services to report whether time is synchronised; that is done by clearing or setting the STA_UNSYNC
status bit using the adjtimex
system call. The kernel itself can set that bit if it determines that time isn’t synchronised, but it never clears it on its own.
date --set
command should be followed by ahwclock --systohc
command, right? – jan Sep 30 '21 at 19:42date --set
command should be followed, sooner or later, byhwclock --systohc
; doing so at system shutdown is usually considered to be sufficient. I’m about to update the answer to explain what “reports” means. – Stephen Kitt Oct 01 '21 at 06:56