time

package
v1.16.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

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

View Source
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

View Source
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
)
View Source
var (
	MaxInternalTimerDelay time.Duration
)

Functions

func After

func After(d Duration) <-chan Time

After overrides the stdlib time.After to enforce maximum sleepiness via option.MaxInternalTimerDelay.

func AfterFunc

func AfterFunc(d Duration, f func()) *time.Timer

AfterFunc overrides the stdlib time.AfterFunc to enforce maximum sleepiness via option.MaxInternalTimerDelay.

func NewTicker

func NewTicker(d Duration) *time.Ticker

NewTicker overrides the stdlib time.NewTicker to enforce maximum sleepiness via option.MaxInternalTimerDelay.

func NewTimer

func NewTimer(d Duration) *time.Timer

NewTimer overrides the stdlib time.NewTimer to enforce maximum sleepiness via option.MaxInternalTimerDelay.

func NewTimerWithoutMaxDelay added in v1.15.0

func NewTimerWithoutMaxDelay(d Duration) *time.Timer

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.

func Sleep

func Sleep(d time.Duration)

Sleep overrides the stdlib time.Sleep to enforce maximum sleepiness via option.MaxInternalTimerDelay.

func Tick

func Tick(d Duration) <-chan time.Time

Tick overrides the stdlib time.Tick to enforce maximum sleepiness via option.MaxInternalTimerDelay.

Types

type Duration

type Duration = time.Duration

type Location

type Location = time.Location

type Month

type Month = time.Month

type ParseError

type ParseError = time.ParseError

type Ticker

type Ticker = time.Ticker

type Time

type Time = time.Time

type Timer

type Timer = time.Timer

type Weekday

type Weekday = time.Weekday

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL