clock

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package clock abstracts time.Now for testability so that higher layers can inject fake clocks in unit tests without coupling to the wall clock.

Package clock — hosts compile-time interface assertions — keeping them out of the production source so the runtime binary carries no diagnostic-only declarations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	// Now returns the current instant.
	Now() time.Time
	// Since returns the elapsed duration between the given instant and Now.
	Since(t time.Time) time.Duration
}

Clock produces timestamps and durations. Implementations must be safe for concurrent use by multiple goroutines.

var System Clock = systemClock{}

System is the default Clock using the package time wall clock.

Jump to

Keyboard shortcuts

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