faketime

package
v0.0.0-...-c88ffa3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0, MIT Imports: 5 Imported by: 2

Documentation

Overview

Package faketime provides a fake clock that implements tcpip.Clock interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ManualClock

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

ManualClock implements tcpip.Clock and only advances manually with Advance method.

+stateify savable

func NewManualClock

func NewManualClock() *ManualClock

NewManualClock creates a new ManualClock instance.

func (*ManualClock) Advance

func (mc *ManualClock) Advance(d time.Duration)

Advance executes all work that have been scheduled to execute within d from the current time. Blocks until all work has completed execution.

func (*ManualClock) AfterFunc

func (mc *ManualClock) AfterFunc(d time.Duration, f func()) tcpip.Timer

AfterFunc implements tcpip.Clock.AfterFunc.

func (*ManualClock) Now

func (mc *ManualClock) Now() time.Time

Now implements tcpip.Clock.Now.

func (*ManualClock) NowMonotonic

func (mc *ManualClock) NowMonotonic() tcpip.MonotonicTime

NowMonotonic implements tcpip.Clock.NowMonotonic.

func (*ManualClock) RunImmediatelyScheduledJobs

func (mc *ManualClock) RunImmediatelyScheduledJobs()

RunImmediatelyScheduledJobs runs all jobs scheduled to run at the current time.

type NullClock

type NullClock struct{}

NullClock implements a clock that never advances.

+stateify savable

func (*NullClock) AfterFunc

func (*NullClock) AfterFunc(time.Duration, func()) tcpip.Timer

AfterFunc implements tcpip.Clock.AfterFunc.

func (*NullClock) Now

func (*NullClock) Now() time.Time

Now implements tcpip.Clock.Now.

func (*NullClock) NowMonotonic

func (*NullClock) NowMonotonic() tcpip.MonotonicTime

NowMonotonic implements tcpip.Clock.NowMonotonic.

Jump to

Keyboard shortcuts

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