Some solutions require the ability to set the date and time without Internet time synchronization.
The ComfilePi Trixie OS uses chrony.
Chrony is enabled and running by default. The default configuration already compensates for system clock drift and keeps the RTC updated.
The default /etc/chrony/chrony.conf includes these important settings:
driftfile /var/lib/chrony/chrony.drift rtcsync makestep 1 3
driftfile stores the measured system clock drift. Chrony uses this file to keep the system clock accurate, even when the system is temporarily disconnected from the Internet.
rtcsync keeps the RTC updated from the synchronized system clock. When the system clock is synchronized, Linux automatically writes the correct time to the RTC.
makestep allows chrony to quickly correct a large time error during startup.
Stop chrony first so it does not adjust the clock while you are setting it.
sudo systemctl stop chrony # Set the date and time. Example: July 8th, 2026 5:30am local time sudo timedatectl set-time '2026-07-08 05:30:00' sudo systemctl start chrony
Confirm the system clock and RTC with the date and hwclock commands respectively.
date sudo hwclock --show
Run the following commands in a terminal to set the ComfilePi's date and time and save it to the ComfilePi's RTC.
# Disable synchronization with the time server sudo timedatectl set-ntp false # Set the date and time. Example: January 2nd, 2026 5:30am local time sudo timedatectl set-time '2026-01-02 05:30:00'
This sets both the system time and the RTC time.
NOTE: Modern Linux has a built-in safety feature that may advance the system clock if the configured time is earlier than the operating system's expected minimum time. When manually setting the date and time for testing, use a date and time after the operating system image build date.
There are two clocks that have the potential to drift: the RTC and the operating system's system clock. Both can drift independently.
If the RTC drift is consistent and predictable, configure compensation with the following procedure:
sudo ntpdate pool.ntp.org to synchronize the system time.sudo hwclock –systohc –utc –update-drift to synchronize the RTC with the system time and update /etc/adjtime.sudo ntpdate pool.ntp.org.sudo hwclock –systohc –utc –update-drift.
Create /etc/udev/rules.d/85-hwclock.rules:
ACTION=="add", SUBSYSTEM=="rtc", KERNEL=="rtc0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="hwclock.service"
Create /etc/systemd/system/hwclock.service:
[Unit] Description=Set system clock from RTC with adjtime compensation ConditionPathExists=/dev/rtc0 ConditionPathExists=/etc/adjtime [Service] Type=oneshot ExecCondition=/bin/sh -ec 'timedatectl show --property=NTP 2>/dev/null | grep -qx "NTP=no"' ExecStart=/sbin/hwclock --rtc=/dev/rtc0 --hctosys
Reboot and then confirm the system clock and RTC with the date and hwclock commands respectively.
date sudo hwclock --show
After configuring RTC drift compensation, install and configure adjtimex.
sudo apt update sudo apt install adjtimex sudo adjtimexconfig sudo systemctl enable adjtimex.service
adjtimexconfig measures the system clock drift relative to the RTC, saves it to /etc/default/adjtimex, and adjtimex.service loads that configuration at boot.