sing/common/ntp/time_unix.go
2024-03-26 20:40:59 +08:00

14 lines
222 B
Go

//go:build linux || darwin
package ntp
import (
"time"
"golang.org/x/sys/unix"
)
func SetSystemTime(nowTime time.Time) error {
timeVal := unix.NsecToTimeval(nowTime.UnixNano())
return unix.Settimeofday(&timeVal)
}