Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Duration ¶ added in v1.1.0
Duration converts a time string with unit to time.Duration Valid time units are 'ns', 'us', 'ms', 's', 'm', 'h', `d` and `w`
Example ¶
d := Duration("5ms") fmt.Printf("duration is %d milliseconds", d.Milliseconds())
Output: duration is 5 milliseconds
func Microseconds ¶
Microseconds converts a time string with unit to an integer number of microseconds Valid time units are 'ns', 'us', 'ms', 's', 'm', 'h', `d` and `w`
Example ¶
us := Microseconds("3ms") fmt.Printf("period is %d microseconds", us)
Output: period is 3000 microseconds
func Milliseconds ¶
Milliseconds converts a time string with unit to an integer number of milliseconds Valid time units are 'ns', 'us', 'ms', 's', 'm', 'h', `d` and `w`
Example ¶
ms := Milliseconds("5s") fmt.Printf("period is %d milliseconds", ms)
Output: period is 5000 milliseconds
func Nanoseconds ¶
Nanoseconds converts a time string with unit to an integer number of nanoseconds Valid time units are 'ns', 'us', 'ms', 's', 'm', 'h', `d` and `w`
Example ¶
ns := Nanoseconds("4us") fmt.Printf("period is %d nanoseconds", ns)
Output: period is 4000 nanoseconds
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.