Help us shape the future of Go! Take the 2026 Go Developer Survey

clocktest

package
v1.0.0-rc.12 Latest Latest
Warning

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

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

Documentation

Overview

Package clocktest holds a clock for tests that must see how often an operation reads its owner's clock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stepping

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

Stepping is a clock that moves on by its step at every reading. An operation that reads it twice sees two different times, so a record and its receipt stamped by separate readings disagree where one shared reading would make them equal.

func NewStepping

func NewStepping(start time.Time, step time.Duration) *Stepping

NewStepping is a clock whose first reading is start.

func (*Stepping) Next

func (c *Stepping) Next() time.Time

Next is the time the next reading will give, without taking it.

func (*Stepping) Now

func (c *Stepping) Now() time.Time

Now takes a reading and moves the clock on.

Jump to

Keyboard shortcuts

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