From c5bbdc1d11f483a71b0444fb5fe2f9d9424b9fbe Mon Sep 17 00:00:00 2001 From: Tugdual Saunier Date: Tue, 15 Apr 2025 02:46:54 -0400 Subject: [PATCH] feat: synchronise hardware clock after NTP sync, fix#319 Not synchronising the hardware clock causes the time to be lost on next reboot, making features such as OTA updates check fail. --- ntp.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ntp.go b/ntp.go index a104c56..33cb32f 100644 --- a/ntp.go +++ b/ntp.go @@ -193,5 +193,9 @@ func setSystemTime(now time.Time) error { if err != nil { return fmt.Errorf("failed to run date -s: %w, %s", err, string(output)) } + output, err = exec.Command("hwclock", "-w").CombinedOutput() + if err != nil { + return fmt.Errorf("failed to run hwclock -w: %w, %s", err, string(output)) + } return nil }