github.com/sagernet/sing-box@v1.9.0-rc.20/common/settings/time_unix.go (about)

     1  //go:build linux || darwin
     2  
     3  package settings
     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  }