timekeeper

package
v2.3.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: Apache-2.0 Imports: 1 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RealTime

type RealTime struct{}

RealTime calls bulit in time package functions that follow the real flow of time

func (RealTime) After

func (RealTime) After(d time.Duration) <-chan time.Time

After calls time.After

func (RealTime) NewTimer

func (RealTime) NewTimer(d time.Duration) Timer

NewTimer calls time.NewTimer and gives it a stubable interface

func (RealTime) Now

func (RealTime) Now() time.Time

Now calls time.Now()

func (RealTime) Sleep

func (RealTime) Sleep(dur time.Duration)

Sleep calls time.Sleep

type TimeKeeper

type TimeKeeper interface {
	Now() time.Time
	Sleep(dur time.Duration)
	After(d time.Duration) <-chan time.Time
	NewTimer(d time.Duration) Timer
}

TimeKeeper is how we stub the progress of time in applications

type Timer

type Timer interface {
	Chan() <-chan time.Time
	Stop() bool
}

Timer is an object that returns periodic timing events. We use the builtin time.NewTimer() generally but can also stub this out in constructors

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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