clock

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventTimeSource

type EventTimeSource struct {
	// contains filtered or unexported fields
}

EventTimeSource serves fake controlled time

func NewEventTimeSource

func NewEventTimeSource() *EventTimeSource

NewEventTimeSource returns a time source that servers fake controlled time

func (*EventTimeSource) Now

func (ts *EventTimeSource) Now() time.Time

Now return the fake current time

func (*EventTimeSource) Update

func (ts *EventTimeSource) Update(now time.Time) *EventTimeSource

Update update the fake current time

type RealTimeSource

type RealTimeSource struct{}

RealTimeSource serves real wall-clock time

func NewRealTimeSource

func NewRealTimeSource() *RealTimeSource

NewRealTimeSource returns a time source that servers real wall clock time

func (*RealTimeSource) Now

func (ts *RealTimeSource) Now() time.Time

Now return the real current time

type TimeSource

type TimeSource interface {
	Now() time.Time
}

TimeSource is an interface for any entity that provides the current time. Its primarily used to mock out timesources in unit test

Jump to

Keyboard shortcuts

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