mockclock

package
v0.36.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentTimeUnixMock int64 = 1694097824

Thursday, 7th September 2023 14:43:44

Variables

This section is empty.

Functions

This section is empty.

Types

type AdvanceableClock

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

AdvanceableClock is a mock implementation of the core.Clock interface that allows for advancing the clock by a specified duration.

func NewAdvanceableClock

func NewAdvanceableClock(
	currentTime time.Time,
) *AdvanceableClock

NewAdvanceableClock creates a new instance of AdvanceableClock with the current time set to the provided time. This is useful for testing scenarios where the clock needs to be advanced to simulate the passage of time.

func (*AdvanceableClock) Advance

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

Advance advances the clock by the given duration, this is not a part of the Clock interface, but is useful for testing scenarios where the clock needs to be advanced to simulate the passage of time.

func (*AdvanceableClock) Now

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

func (*AdvanceableClock) Since

func (c *AdvanceableClock) Since(t time.Time) time.Duration

type StaticClock

type StaticClock struct{}

func (*StaticClock) Now

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

func (*StaticClock) Since

func (c *StaticClock) Since(t time.Time) time.Duration

Jump to

Keyboard shortcuts

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