| 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.Since(before) |
| 11 | } |
| 12 | |
| 13 | func msSinceStartup() int64 { |
| 14 | return int64(time.Since(startup) / time.Millisecond) |
| 15 | } |
| 16 |
Members