clock

package
v3.1.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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