github.com/sagernet/sing@v0.4.0-beta.19.0.20240518125136-f67a0988a636/common/ntp/time_unix.go (about)

     1  //go:build linux || darwin
     2  
     3  package ntp
     4  
     5  import (
     6  	"time"
     7  
     8  	"golang.org/x/sys/unix"
     9  )
    10  
    11  func SetSystemTime(nowTime time.Time) error {
    12  	timeVal := unix.NsecToTimeval(nowTime.UnixNano())
    13  	return unix.Settimeofday(&timeVal)
    14  }