Documentation ¶
Overview ¶
package time is a wrapper for the stdlib time library that aliases most underlying types, but allows overrides for testing purposes.
Synced to go-1.20.7.
Index ¶
- Constants
- Variables
- func After(d Duration) <-chan Time
- func AfterFunc(d Duration, f func()) *time.Timer
- func NewTicker(d Duration) *time.Ticker
- func NewTimer(d Duration) *time.Timer
- func NewTimerWithoutMaxDelay(d Duration) *time.Timer
- func Sleep(d time.Duration)
- func Tick(d Duration) <-chan time.Time
- type Duration
- type Location
- type Month
- type ParseError
- type Ticker
- type Time
- type Timer
- type Weekday
Constants ¶
const ( Layout = time.Layout ANSIC = time.ANSIC UnixDate = time.UnixDate RubyDate = time.RubyDate RFC822 = time.RFC822 RFC822Z = time.RFC822Z RFC850 = time.RFC850 RFC1123 = time.RFC1123 RFC1123Z = time.RFC1123Z RFC3339 = time.RFC3339 RFC3339Nano = time.RFC3339Nano Kitchen = time.Kitchen Stamp = time.Stamp StampMilli = time.StampMilli StampMicro = time.StampMicro StampNano = time.StampNano DateTime = time.DateTime DateOnly = time.DateOnly TimeOnly = time.TimeOnly Nanosecond = time.Nanosecond Microsecond = time.Microsecond Millisecond = time.Millisecond Second = time.Second Minute = time.Minute Hour = time.Hour )
Variables ¶
var ( ParseDuration = time.ParseDuration Since = time.Since Until = time.Until FixedZone = time.FixedZone LoadLocation = time.LoadLocation LoadLocationFromTZData = time.LoadLocationFromTZData Date = time.Date Now = time.Now Parse = time.Parse ParseInLocation = time.ParseInLocation Unix = time.Unix UnixMicro = time.UnixMicro UnixMilli = time.UnixMilli )
var (
MaxInternalTimerDelay time.Duration
)
Functions ¶
func After ¶
After overrides the stdlib time.After to enforce maximum sleepiness via option.MaxInternalTimerDelay.
func AfterFunc ¶
AfterFunc overrides the stdlib time.AfterFunc to enforce maximum sleepiness via option.MaxInternalTimerDelay.
func NewTicker ¶
NewTicker overrides the stdlib time.NewTicker to enforce maximum sleepiness via option.MaxInternalTimerDelay.
func NewTimer ¶
NewTimer overrides the stdlib time.NewTimer to enforce maximum sleepiness via option.MaxInternalTimerDelay.
func NewTimerWithoutMaxDelay ¶ added in v1.15.0
NewTimerWithoutMaxDelay returns a time.NewTimer without enforcing maximum sleepiness. This function should only be used in cases where the timer firing early impacts correctness. If in doubt, you probably should use NewTimer.
Types ¶
type ParseError ¶
type ParseError = time.ParseError