timekeeper

package
v3.3.46 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 1 Imported by: 1

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