clock

package
v3.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TickUntil

func TickUntil(m *MockClock, shouldStop func() bool, realSleep time.Duration, mockIncr time.Duration)

TickUntil will tick the mock clock until shouldStop returns false. Real sleep should be very small

Types

type MockClock

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

MockClock allows mocking time for testing

func (*MockClock) Add

func (m *MockClock) Add(d time.Duration) time.Time

Add some time, triggering sleeping callbacks

func (*MockClock) After

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

AfterFunc simulates time.After

func (*MockClock) AfterFunc

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

AfterFunc simulates time.AfterFunc

func (*MockClock) Now

func (m *MockClock) Now() time.Time

Now simulates time.Now()

func (*MockClock) Set

func (m *MockClock) Set(t time.Time) time.Time

Set the current time

Jump to

Keyboard shortcuts

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