mockable

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: BSD-3-Clause Imports: 1 Imported by: 155

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxTime = time.Unix(1<<63-62135596801, 0) // 0 is used because we drop the nano-seconds

MaxTime was taken from https://stackoverflow.com/questions/25065055/what-is-the-maximum-time-time-in-go/32620397#32620397

Functions

This section is empty.

Types

type Clock

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

Clock acts as a thin wrapper around global time that allows for easy testing

func (*Clock) Set

func (c *Clock) Set(time time.Time)

Set the time on the clock

func (*Clock) Sync

func (c *Clock) Sync()

Sync this clock with global time

func (*Clock) Time

func (c *Clock) Time() time.Time

Time returns the time on this clock

func (*Clock) Unix

func (c *Clock) Unix() uint64

Unix returns the unix timestamp on this clock.

func (*Clock) UnixTime added in v1.7.14

func (c *Clock) UnixTime() time.Time

Time returns the unix time on this clock

Jump to

Keyboard shortcuts

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