Documentation
¶
Index ¶
Constants ¶
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.
Safe for concurrent use: code under test can poll the clock from one goroutine while the test advances it from another, which is how a timeout that is waited on rather than simulated has to be exercised.
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
type StaticClock ¶
type StaticClock struct{}
func (*StaticClock) Now ¶
func (c *StaticClock) Now() time.Time