Documentation ¶
Index ¶
Constants ¶
View Source
const ( Nanosecond Duration = 1 Microsecond = 1000 * Nanosecond Millisecond = 1000 * Microsecond Second = 1000 * Millisecond Minute = 60 * Second Hour = 60 * Minute )
Common durations. There is no definition for units of Day or larger to avoid confusion across daylight savings time zone transitions.
To count the number of units in a Duration, divide:
second := time.Second fmt.Print(int64(second/time.Millisecond)) // prints 1000
To convert an integer number of units to a Duration, multiply:
seconds := 10 fmt.Print(time.Duration(seconds)*time.Second) // prints 10s
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Duration ¶
type Duration int64
A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years.
func (Duration) Nanoseconds ¶
Nanoseconds returns the duration as an integer nanosecond count.
type FastTime ¶
type FastTime struct {
// contains filtered or unexported fields
}
fast time struct stored on stack
func NewFastTime ¶
func NewFastTime() FastTime
func (FastTime) UnsafeBytes ¶
Click to show internal directories.
Click to hide internal directories.