Sample Header Ad - 728x90

How to confirm that the kernel is (or is not) updating the hwclock/RTC

0 votes
2 answers
187 views
This question is a follow-up to [this answer](https://unix.stackexchange.com/a/671093/286615) . In general, my objective is to learn if my system (Debian/Raspberry Pi 5 'bookworm') is updating my RTC/hardware clock from the system time. Please note that the RPi 5 (unlike its Pi ancestors) does have an *in-built* RTC/hardware clock. Here's what I've been able to determine so far: ##### 1. I feel I've established that the system clock is being updated from the hwclock:
$ dmesg | grep "system clock" 

[    1.588793] rpi-rtc soc:rpi_rtc: setting system clock to 2025-02-18T04:59:13 UTC (1739854753)
After some searching in dmesg however, I can find no indication that the hwclock is being updated from system time. However, I **did** find a reference to a fake-hardware clock (which seems *odd*). :
[    4.037230] systemd: Starting fake-hwclock.service - Restore / save the current clock...
##### 2. The kernel is apparently configured to do clock updates in "both directions":
$ cat /boot/config-$(uname -r) | grep -i HCTOSYS
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"  

$ cat /boot/config-$(uname -r) | grep -i SYSTOHC
CONFIG_RTC_SYSTOHC=y
CONFIG_RTC_SYSTOHC_DEVICE="rtc0"
It's occurred to me that the kernel ***may be*** performing the SYSTOHC sync only during shutdown, and maybe not being captured by dmesg... but that's a WAG. **Can someone explain how to confirm that the kernel is (or is not) updating the hwclock/RTC?**
Asked by Seamus (3772 rep)
Feb 18, 2025, 05:53 AM
Last activity: Feb 18, 2025, 09:27 AM