timeutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TimeEq

func TimeEq(t time.Time) oglematchers.Matcher

Return a matcher for times that are exactly equal to the given input time.

func TimeNear

func TimeNear(t time.Time, d time.Duration) oglematchers.Matcher

Return a matcher for times whose absolute distance from t is less than d.

Types

type Clock

type Clock interface {
	Now() time.Time
}

func RealClock

func RealClock() Clock

Return a clock that follows the real time, according to the system.

type SimulatedClock

type SimulatedClock struct {
	Clock
	// contains filtered or unexported fields
}

A clock that allows for manipulation of the time, which does not change unless AdvanceTime is called. The zero value is a clock initialized to the zero time.

func (*SimulatedClock) AdvanceTime

func (sc *SimulatedClock) AdvanceTime(d time.Duration)

Advance the current time according to the clock by the supplied duration.

func (*SimulatedClock) Now

func (sc *SimulatedClock) Now() time.Time

func (*SimulatedClock) SetTime

func (sc *SimulatedClock) SetTime(t time.Time)

Set the current time according to the clock.

Jump to

Keyboard shortcuts

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