Documentation ¶
Overview ¶
Package timeutil contains types and utilities for dealing with time and duration values.
Index ¶
Constants ¶
View Source
const Day time.Duration = 24 * time.Hour
Day is the duration of one day.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
Duration is a wrapper for time.Duration providing functionality for encoding.
func (Duration) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for Duration.
func (Duration) String ¶
String implements the fmt.Stringer interface for Duration. It wraps time.Duration.String method and additionally cuts off non-leading zero values of minutes and seconds. Some values which are differ between the implementations:
Duration: "1m", time.Duration: "1m0s" Duration: "1h", time.Duration: "1h0m0s" Duration: "1h1m", time.Duration: "1h1m0s"
func (*Duration) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for *Duration.
TODO(e.burkov): Make it able to parse larger units like days.
Click to show internal directories.
Click to hide internal directories.