package main import ( "time" "fmt" ) func main() { t := time.Now().UnixNano() fmt.Println(t) t2 := time.Unix(0,t) fmt.Println(t2) t3 := time.Unix(100,t) fmt.Println(t3) }
go time package provides support of time. The operating system supports two clocks. One is wall clock, providing time stamp. The other is monotonic clock. The latter one is ususlly used to measure a duration. This is an example for conversion between int64 and time object.