Documentation
¶
Overview ¶
Package clock provides a clock interface. clock package is a adapter class for k8s.io/utils/clock.
Index ¶
- type Clock
- type PassiveClock
- type RealClock
- func (c *RealClock) After(d time.Duration) <-chan time.Time
- func (c *RealClock) NewTimer(d time.Duration) k8sclock.Timer
- func (c *RealClock) Now() time.Time
- func (c *RealClock) Since(t time.Time) time.Duration
- func (c *RealClock) Sleep(d time.Duration)
- func (c *RealClock) Tick(d time.Duration) <-chan time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock interface {
PassiveClock
// After returns the channel of a new Timer.
// This method does not allow to free/GC the backing timer before it fires. Use
// NewTimer instead.
After(d time.Duration) <-chan time.Time
// NewTimer returns a new Timer.
NewTimer(d time.Duration) k8sclock.Timer
// Sleep sleeps for the provided duration d.
// Consider making the sleep interruptible by using 'select' on a context channel and a timer channel.
Sleep(d time.Duration)
// Tick returns the channel of a new Ticker.
// This method does not allow to free/GC the backing ticker. Use
// NewTicker from WithTicker instead.
Tick(d time.Duration) <-chan time.Time
}
Clock is from k8s.io/utils/clock.
type PassiveClock ¶
PassiveClock is a passive clock interface.
type RealClock ¶ added in v0.1.18
RealClock implements Clock using the system clock.
func NewRealClock ¶ added in v0.1.18
func NewRealClock() *RealClock
NewRealClock returns a new RealClock using the system clock.
func (*RealClock) After ¶ added in v0.1.18
After waits for the duration to elapse and then sends the current time on the returned channel.
func (*RealClock) NewTimer ¶ added in v0.1.18
NewTimer returns a new Timer that will send the current time on its channel after at least duration d.
Click to show internal directories.
Click to hide internal directories.