Help us shape the future of Go! Take the 2026 Go Developer Survey

mockable

package
v1.29.3 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: BSD-3-Clause Imports: 2 Imported by: 14

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. It is safe for concurrent use.

func (*Clock) Set

func (c *Clock) Set(t 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

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