Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock struct {
// contains filtered or unexported fields
}
Clock provides a clock capable of returning current times up to a certain level of precision, far faster than using time.Now(). It does this by performing this regularly and caching the result, same for the formatted time string. All operations are atomic and protected by mutexes where necessary :).
func Start ¶
Start returns a new Clock instance initialized and started with the provided precision, along with the stop function for it's underlying timer.
func (*Clock) NowFormat ¶
NowFormat returns the formatted "now" time, cached until next tick and "now" updates.
type Timeout ¶
type Timeout struct {
// contains filtered or unexported fields
}
Timeout provides a reusable structure for enforcing timeouts with a cancel.
func (*Timeout) Cancel ¶
func (t *Timeout) Cancel()
Cancel cancels the currently running timer. If a cancel is achieved, then this function will return after the timeout goroutine is finished.