clock

package
v0.0.0-...-804b954 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package clock provides explicit time sources for deterministic runtime decisions.

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 UTC instant.
	Now() time.Time
}

Clock supplies UTC wall-clock instants to a consumer.

type Fake

type Fake struct {
	// contains filtered or unexported fields
}

Fake is a concurrency-safe Clock whose time advances only when requested.

func NewFake

func NewFake(start time.Time) (*Fake, error)

NewFake creates a Fake at start, normalized to UTC.

func (*Fake) Advance

func (f *Fake) Advance(delta time.Duration) error

Advance moves the fake clock forward by delta without waiting.

func (*Fake) Now

func (f *Fake) Now() time.Time

Now returns the fake clock's current UTC instant.

Jump to

Keyboard shortcuts

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