Documentation ¶
Overview ¶
Package faketime provides a fake clock that implements tcpip.Clock interface.
Index ¶
- type ManualClock
- func (mc *ManualClock) Advance(d time.Duration)
- func (mc *ManualClock) AfterFunc(d time.Duration, f func()) tcpip.Timer
- func (mc *ManualClock) Now() time.Time
- func (mc *ManualClock) NowMonotonic() tcpip.MonotonicTime
- func (mc *ManualClock) RunImmediatelyScheduledJobs()
- func (mc *ManualClock) StateFields() []string
- func (mc *ManualClock) StateLoad(ctx context.Context, stateSourceObject state.Source)
- func (mc *ManualClock) StateSave(stateSinkObject state.Sink)
- func (mc *ManualClock) StateTypeName() string
- type NullClock
- func (*NullClock) AfterFunc(time.Duration, func()) tcpip.Timer
- func (*NullClock) Now() time.Time
- func (*NullClock) NowMonotonic() tcpip.MonotonicTime
- func (n *NullClock) StateFields() []string
- func (n *NullClock) StateLoad(ctx context.Context, stateSourceObject state.Source)
- func (n *NullClock) StateSave(stateSinkObject state.Sink)
- func (n *NullClock) StateTypeName() string
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) 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.
func (*ManualClock) StateFields ¶
func (mc *ManualClock) StateFields() []string
func (*ManualClock) StateLoad ¶
func (mc *ManualClock) StateLoad(ctx context.Context, stateSourceObject state.Source)
+checklocksignore
func (*ManualClock) StateSave ¶
func (mc *ManualClock) StateSave(stateSinkObject state.Sink)
+checklocksignore
func (*ManualClock) StateTypeName ¶
func (mc *ManualClock) StateTypeName() string
type NullClock ¶
type NullClock struct{}
NullClock implements a clock that never advances.
+stateify savable
func (*NullClock) NowMonotonic ¶
func (*NullClock) NowMonotonic() tcpip.MonotonicTime
NowMonotonic implements tcpip.Clock.NowMonotonic.