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

testclock

package
v1.30.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package testclock is a settable clock for tests that would otherwise sleep through a TTL, grace window or rate-limit window.

Index

Constants

This section is empty.

Variables

View Source
var Use func(client any, now func() time.Time)

Use makes an *authkit.Client decide TTLs and grace windows by now; call it before the Client serves. Ephemeral state keeps the database clock. The root package sets it: hosts have no way to change the clock.

Functions

This section is empty.

Types

type Clock

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

Clock is the wall clock shifted by every Advance so far.

func Wall

func Wall() *Clock

Wall follows the wall clock plus the accumulated Advance offset.

func (*Clock) Advance

func (c *Clock) Advance(d time.Duration)

func (*Clock) Now

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

Now is the func() time.Time the seams accept.

Jump to

Keyboard shortcuts

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