github.com/hamba/timex@v1.2.1-0.20240304044353-56d3de3a9ed9/time_now_go1_17.go (about) 1 //go:build go1.17 2 // +build go1.17 3 4 package timex 5 6 import _ "unsafe" // for go:linkname 7 8 //go:linkname now time.now 9 func now() (int64, int32, int64) 10 11 // Now returns the current time in nanoseconds. 12 func Now() int64 { 13 sec, nsec, _ := now() 14 return sec*1000000000 + int64(nsec) 15 } 16 17 // Unix returns the current time in seconds. 18 func Unix() int64 { 19 sec, _, _ := now() 20 return sec 21 }