Documentation ¶
Overview ¶
Package timing provides utilities for time
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ClearDelayCh is used to stop all ongoing delays ClearDelayCh = make(chan bool) )
Functions ¶
func DoAfter ¶
DoAfter wraps time calls in a select that will stop events from happening when ClearDelayCh pulls
func FPS ¶
FPS returns the number of frames being processed per second, supposing a time interval from lastTime to now.
func FPSToDuration ¶
FPSToDuration converts a frameRate like 60fps into a duration
Types ¶
type DynamicTicker ¶
A DynamicTicker is a ticker which can be sent signals in the form of durations to change how often it ticks.
func NewDynamicTicker ¶
func NewDynamicTicker() *DynamicTicker
NewDynamicTicker returns a null-initialized dynamic ticker
func (*DynamicTicker) ForceStep ¶
func (dt *DynamicTicker) ForceStep()
ForceStep is the blocking equivalent to Step. After this is called, it won't return until the ticker has taken the forced step through. A potential use for this is in benchmarking how often the work between ticks can get done.
func (*DynamicTicker) SetTick ¶
func (dt *DynamicTicker) SetTick(d time.Duration)
SetTick changes the rate at which a dynamic ticker ticks
func (*DynamicTicker) Step ¶
func (dt *DynamicTicker) Step()
Step will force the dynamic ticker to tick, once. If the forced tick is not received, multiple calls to step will do nothing.
func (*DynamicTicker) Stop ¶
func (dt *DynamicTicker) Stop()
Stop closes all internal channels and stops dt's internal ticker