1 package B1 2 3 import "time" 4 5 var startup = time.Now() 6 7 func example() time.Duration { 8 before := time.Now() 9 time.Sleep(1) 10 return time.Now().Sub(before) 11 } 12 13 func msSinceStartup() int64 { 14 return int64(time.Now().Sub(startup) / time.Millisecond) 15 } 16