Duration

Duration is the time elapsed between two instants of time. It is represented as a count of int64 nanoseconds. So duration is just a number representing time in nanoseconds in Go. This is represented as follows in the 'time' package:


type Duration int64
                        

Below are some of the common durations in the package:


const (
    Nanosecond  Duration = 1
    Microsecond          = 1000 * Nanosecond
    Millisecond          = 1000 * Microsecond
    Second               = 1000 * Millisecond
    Minute               = 60 * Second
    Hour                 = 60 * Minute
)
                        
duration.go