timewrapper

package
v3.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeTime

type FakeTime struct {
	Time time.Time
}

FakeTime holds the global fake time.

func (*FakeTime) Now

func (ft *FakeTime) Now() time.Time

Now returns the global fake time.

func (*FakeTime) Sleep

func (ft *FakeTime) Sleep(d time.Duration)

Sleep adds the given duration to the global fake time.

type RealTime

type RealTime struct{}

RealTime is a wrapper for actual time functions.

func (RealTime) Now

func (RealTime) Now() time.Time

Now simply calls time.Now()

func (RealTime) Sleep

func (RealTime) Sleep(d time.Duration)

Sleep simply calls time.Sleep(d), using the given duration.

type Time

type Time interface {
	Now() time.Time
	Sleep(d time.Duration)
}

Time groups the functions mocked by FakeTime.

Jump to

Keyboard shortcuts

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