clock

package
v0.0.0-...-e2cdd45 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package clock provides time-related utilities and wrappers

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

func Since

func Since(t time.Time) time.Duration

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

type Timer

type Timer interface {
	Reset(d time.Duration) bool
}

func AfterFunc

func AfterFunc(d time.Duration, f func()) Timer

Jump to

Keyboard shortcuts

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