mirror of https://github.com/jetkvm/kvm.git
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:
parent
009b0abbe9
commit
c5bbdc1d11
4
ntp.go
4
ntp.go
|
@ -193,5 +193,9 @@ func setSystemTime(now time.Time) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to run date -s: %w, %s", err, string(output))
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue