internal

package
v0.174.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NowFunc       func() time.Time
	SleepFunc     func(d time.Duration)
	AfterFunc     func(d time.Duration) <-chan time.Time
	NewTickerFunc func(d time.Duration) *TickerProxy
)

Functions

func After added in v0.160.0

func After(d time.Duration) <-chan time.Time

func Notify added in v0.154.0

func Notify(c chan<- TimeTravelEvent) func()

func RemainingDuration

func RemainingDuration(from time.Time, nonScaledDuration time.Duration) time.Duration

func ScaledDuration added in v0.154.0

func ScaledDuration(d time.Duration) time.Duration

func SetSpeed

func SetSpeed(s float64) func()

func SetTime

func SetTime(target time.Time, opt Option) func()

func TimeNow added in v0.154.0

func TimeNow() time.Time

Types

type Option

type Option struct {
	Freeze   bool
	Unfreeze bool
	Deep     bool
}

type Ticker added in v0.160.0

type Ticker struct {
	C chan time.Time
	// contains filtered or unexported fields
}

func NewTicker added in v0.160.0

func NewTicker(d time.Duration) *Ticker

func (*Ticker) Reset added in v0.160.0

func (t *Ticker) Reset(d time.Duration)

func (*Ticker) Stop added in v0.160.0

func (t *Ticker) Stop()

Stop turns off a ticker. After Stop, no more ticks will be sent. Stop does not close the channel, to prevent a concurrent goroutine reading from the channel from seeing an erroneous "tick".

type TickerProxy added in v0.160.0

type TickerProxy struct {
	C <-chan time.Time
	// contains filtered or unexported fields
}

TickerProxy helps enable us to switch freely between time.Ticker and clock's Ticker implementation.

func (*TickerProxy) Reset added in v0.160.0

func (tp *TickerProxy) Reset(d time.Duration)

func (*TickerProxy) Stop added in v0.160.0

func (tp *TickerProxy) Stop()

type TimeTravelEvent added in v0.160.0

type TimeTravelEvent struct {
	Deep   bool
	Freeze bool
	When   time.Time
	Prev   time.Time
}

func Check added in v0.160.0

func Check() (TimeTravelEvent, bool)

type Timeline added in v0.160.0

type Timeline struct {
	Altered bool
	SetAt   time.Time
	When    time.Time
	Prev    time.Time
	Frozen  bool
	Deep    bool
	Speed   float64
}

func (Timeline) IsZero added in v0.160.0

func (tl Timeline) IsZero() bool

Jump to

Keyboard shortcuts

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