faketime

package
v0.32.6 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: Unlicense Imports: 2 Imported by: 0

Documentation

Overview

Package faketime contains fake implementations of interfaces from package timeutil.

It is recommended to fill all methods that shouldn't be called with:

panic("not implemented")

in the body of the test, so that if the method is called the panic backtrace points to the method definition in the test. See the package example.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock struct {
	OnNow func() (now time.Time)
}

Clock is the timeutil.Clock implementation for tests.

func (*Clock) Now

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

Now implements the timeutil.Clock interface for *Clock.

type Schedule

type Schedule struct {
	OnUntilNext func(now time.Time) (d time.Duration)
}

Schedule is the timeutil.Schedule implementation for tests.

func (*Schedule) UntilNext

func (s *Schedule) UntilNext(now time.Time) (d time.Duration)

UntilNext implements the timeutil.Schedule interface for *Schedule.

Jump to

Keyboard shortcuts

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