clock

package
v0.11.1-marc2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock clock.Clock

Clock is a clock

type Mock

type Mock struct {
	*clock.Mock
	// contains filtered or unexported fields
}

Mock is a mock clock that can be precisely controlled

func NewMock

func NewMock(t testing.TB) *Mock

NewMock creates a mock clock which can be precisely controlled

func (*Mock) After

func (m *Mock) After(d time.Duration) <-chan time.Time

After waits for the duration to elapse and then sends the current time on the returned channel.

func (*Mock) Sleep

func (m *Mock) Sleep(d time.Duration)

Sleep pauses the current goroutine for at least the duration d

func (*Mock) Ticker

func (m *Mock) Ticker(d time.Duration) *clock.Ticker

Ticker returns a new Ticker containing a channel that will send the time with a period specified by the duration argument.

func (*Mock) Timer

func (m *Mock) Timer(d time.Duration) *clock.Timer

Timer creates a new Timer containing a channel that will send the time with a period specified by the duration argument.

func (*Mock) TimerCh

func (m *Mock) TimerCh() <-chan time.Duration

func (*Mock) WaitForAfter

func (m *Mock) WaitForAfter(timeout time.Duration, format string, args ...interface{})

WaitForAfter waits up to the specified timeout for After to be called on the clock.

func (*Mock) WaitForSleep

func (m *Mock) WaitForSleep(timeout time.Duration, format string, args ...interface{})

WaitForSleep waits up to the specified timeout for a sleep to begin using the clock.

func (*Mock) WaitForTicker

func (m *Mock) WaitForTicker(timeout time.Duration, format string, args ...interface{})

WaitForTicker waits up to the specified timeout for a Ticker to be created from the clock.

func (*Mock) WaitForTickerMulti

func (m *Mock) WaitForTickerMulti(timeout time.Duration, count int, format string, args ...interface{})

func (*Mock) WaitForTimer

func (m *Mock) WaitForTimer(timeout time.Duration, format string, args ...interface{})

WaitForTimer waits up to the specified timeout for Timer to be called on the clock.

Jump to

Keyboard shortcuts

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