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.
This commit is contained in:
Tugdual Saunier 2025-04-15 02:46:54 -04:00 committed by GitHub
parent 009b0abbe9
commit c5bbdc1d11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

4
ntp.go
View File

@ -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
}