Documentation
¶
Index ¶
- func ContextWithDeadline(parent context.Context, clock Clock, deadline time.Time) (context.Context, context.CancelFunc)
- func ContextWithDeadlineCause(parent context.Context, clock Clock, deadline time.Time, cause error) (context.Context, context.CancelFunc)
- func ContextWithTimeout(parent context.Context, clock Clock, timeout time.Duration) (context.Context, context.CancelFunc)
- func ContextWithTimeoutCause(parent context.Context, clock Clock, timeout time.Duration, cause error) (context.Context, context.CancelFunc)
- type Clock
- type Ticker
- type Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithDeadline ¶
func ContextWithTimeout ¶
Types ¶
type Clock ¶
type Clock interface {
After(d time.Duration) <-chan time.Time
AfterFunc(d time.Duration, f func()) Timer
Now() time.Time
Since(t time.Time) time.Duration
Sleep(d time.Duration)
Tick(d time.Duration) <-chan time.Time
Ticker(d time.Duration) Ticker
Timer(d time.Duration) Timer
}
Clock represents an interface to the functions in the standard library time package. Two implementations are available in the clock package. The first is a real-time clock which simply wraps the time package's functions. The second is a mock clock which will only make forward progress when programmatically adjusted.
Click to show internal directories.
Click to hide internal directories.


