Go: time.Durationの桁数で迷った時にみるページ
code: Go
package main
import (
"fmt"
"time"
)
func main() {
t := time.Now()
time.Sleep(1 * time.Second)
func(t time.Time) {
fmt.Printf("%d", time.Since(t))
}(t)
}
// 1000000000
code: time pkg
const (
Nanosecond Duration = 1
Microsecond = 1000 * Nanosecond
Millisecond = 1000 * Microsecond
Second = 1000 * Millisecond
Minute = 60 * Second
Hour = 60 * Minute
)
jiroshin.icon Durationの1はnanosecond