clock

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package clock provides the injectable time source.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	Now() time.Time
	After(d time.Duration) <-chan time.Time
	NewTicker(d time.Duration) Ticker
}

Clock is the source of time.

type Fake

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

Fake is a manually advanced clock for tests.

func NewFake

func NewFake(start time.Time) *Fake

NewFake returns a fake clock set to start.

func (*Fake) Advance

func (f *Fake) Advance(d time.Duration)

func (*Fake) After

func (f *Fake) After(d time.Duration) <-chan time.Time

func (*Fake) NewTicker

func (f *Fake) NewTicker(d time.Duration) Ticker

func (*Fake) Now

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

func (*Fake) Set

func (f *Fake) Set(t time.Time)

func (*Fake) Waiters

func (f *Fake) Waiters() int

type Real

type Real struct{}

func New

func New() Real

func (Real) After

func (Real) After(d time.Duration) <-chan time.Time

func (Real) NewTicker

func (Real) NewTicker(d time.Duration) Ticker

func (Real) Now

func (Real) Now() time.Time

type Ticker

type Ticker interface {
	C() <-chan time.Time
	Stop()
	Reset(d time.Duration)
}

Jump to

Keyboard shortcuts

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