timekeepertest

package
v3.3.45 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StubClock

type StubClock struct {
	// contains filtered or unexported fields
}

StubClock is a way to stub the progress of time

func NewStubClock

func NewStubClock(now time.Time) *StubClock

NewStubClock creates a new stubbable clock

func (*StubClock) After

func (s *StubClock) After(d time.Duration) <-chan time.Time

After stubs time.After

func (*StubClock) Incr

func (s *StubClock) Incr(dur time.Duration)

Incr the stored time by dur, causing waiting channels to send

func (*StubClock) NewTimer

func (s *StubClock) NewTimer(d time.Duration) timekeeper.Timer

NewTimer stubs time.NewTimer

func (*StubClock) Now

func (s *StubClock) Now() time.Time

Now simulates time.Now and returns the current time of the stubbed clock

func (*StubClock) Set

func (s *StubClock) Set(t time.Time)

Set the time to t

func (*StubClock) Sleep

func (s *StubClock) Sleep(dur time.Duration)

Sleep pauses and returns when the clock has advanced dur duration

Jump to

Keyboard shortcuts

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