clock

package
v1.2.6-prerelease5 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 3 Imported by: 4 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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