Documentation ¶
Overview ¶
Package timeproxy contains functions and data types for working with time. The package exists so that time functionality can be mocked in tests.
Index ¶
- Constants
- func After(d Duration) <-chan Time
- func Sleep(d Duration)
- func Tick(d Duration) <-chan Time
- type Duration
- type Location
- type Month
- type ParseError
- type Proxy
- type RealTime
- func (RealTime) After(d Duration) <-chan Time
- func (RealTime) AfterFunc(d Duration, f func()) *Timer
- func (RealTime) NewTicker(d Duration) *Ticker
- func (RealTime) NewTimer(d Duration) *Timer
- func (RealTime) Now() Time
- func (RealTime) Since(t Time) Duration
- func (RealTime) Sleep(d Duration)
- func (RealTime) Tick(d Duration) <-chan Time
- func (RealTime) Until(t Time) Duration
- type Ticker
- type Time
- type Timer
- type Weekday
Constants ¶
View Source
const ( ANSIC = "Mon Jan _2 15:04:05 2006" UnixDate = "Mon Jan _2 15:04:05 MST 2006" RubyDate = "Mon Jan 02 15:04:05 -0700 2006" RFC822 = "02 Jan 06 15:04 MST" RFC822Z = "02 Jan 06 15:04 -0700" // RFC822 with numeric zone RFC850 = "Monday, 02-Jan-06 15:04:05 MST" RFC1123 = "Mon, 02 Jan 2006 15:04:05 MST" RFC1123Z = "Mon, 02 Jan 2006 15:04:05 -0700" // RFC1123 with numeric zone RFC3339 = "2006-01-02T15:04:05Z07:00" RFC3339Nano = "2006-01-02T15:04:05.999999999Z07:00" Kitchen = "3:04PM" Stamp = "Jan _2 15:04:05" StampMilli = "Jan _2 15:04:05.000" StampMicro = "Jan _2 15:04:05.000000" StampNano = "Jan _2 15:04:05.000000000" )
View Source
const ( Nanosecond Duration = 1 Microsecond = 1000 * Nanosecond Millisecond = 1000 * Microsecond Second = 1000 * Millisecond Minute = 60 * Second Hour = 60 * Minute )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Duration ¶
func ParseDuration ¶
ParseDuration calls time.ParseDuration
type Location ¶
func LoadLocation ¶
LoadLocation calls time.LoadLocation
type ParseError ¶
type ParseError = time.ParseError
type Proxy ¶
type Proxy interface { Now() Time Tick(Duration) <-chan Time After(Duration) <-chan Time Sleep(Duration) NewTicker(Duration) *Ticker AfterFunc(Duration, func()) *Timer NewTimer(Duration) *Timer Since(Time) Duration Until(Time) Duration }
Proxy is a proxy for the time package. By default, the methods from stdlib are called.
type RealTime ¶
type RealTime struct{}
RealTime dispatches all calls to the stdlib time package
type Ticker ¶
type Ticker struct { C <-chan Time StopFunc func() }
Ticker is an abstraction of time.Ticker that can be patched more easily.
type Time ¶
func ParseInLocation ¶
ParseInLocation calls time.ParseInLocation
Click to show internal directories.
Click to hide internal directories.