clock

package
v0.0.0-...-7e516ea Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClock = Clock{clock.New()}

DefaultClock is the underlying Clock used and can be overridden to mock

Functions

func MockTime

func MockTime() *clock.Mock

MockTime sets up the DefaultClock with a consistent time so it can be used across tests

func Now

func Now() time.Time

func Reset

func Reset()

Reset returns the DefaultClock to real time

Types

type Clock

type Clock struct {
	clock.Clock
}

Clock allows mocking time

func (Clock) Now

func (c Clock) Now(loc *time.Location) time.Time

func (Clock) Unix

func (c Clock) Unix(sec int64, nsec int64) time.Time

Jump to

Keyboard shortcuts

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