clock

package
v2.10.55 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 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

func AdjustTimeInLog added in v2.3.0

func AdjustTimeInLog(ctx context.Context, record slog.Record) (slog.Record, bool, error)

AdjustTimeInLog is a slog middleware to adjust timestamps in logs

func ToClockworkClock added in v2.7.2

func ToClockworkClock(clock clock.Clock) clockwork.Clock

Types

type Clock added in v2.7.15

type Clock = clock.Clock
var GlobalClock Clock = global

GlobalClock is the process-wide clock. It delegates every call to the clock installed by Set, so goroutines reading it while a test or timejump swaps the clock do not race. Assigning GlobalClock directly bypasses Set: it is a data race with every background reader, and later Set calls (testx.MockClock, timejump) no longer reach readers of GlobalClock.

func Set added in v2.10.53

func Set(c Clock) Clock

Set installs c as the clock behind GlobalClock and returns the clock it replaces.

Jump to

Keyboard shortcuts

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