gvisorgvisor.dev/gvisor/pkg/tcpip/faketime Index | Files

package faketime

import "gvisor.dev/gvisor/pkg/tcpip/faketime"

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

Index

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.

Source Files

faketime.go

Version
v0.0.0-20250515200445-d30c58e5b8a4 (latest)
Published
May 15, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
2 hours ago

Tools for package owners.