Documentation ¶
Overview ¶
Package timer provides a resettable timer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResettableTimer ¶
type ResettableTimer struct {
// contains filtered or unexported fields
}
ResettableTimer wraps time.Timer to allow resetting the timer to any duration.
func (*ResettableTimer) C ¶
func (rt *ResettableTimer) C() <-chan time.Time
C returns the timer channel.
If the timer was not reset to a non-zero duration, nil is returned.
func (*ResettableTimer) Clear ¶
func (rt *ResettableTimer) Clear()
Clear should be called after receiving from the timer channel.
func (*ResettableTimer) Reset ¶
func (rt *ResettableTimer) Reset(delay time.Duration)
Reset resets the timer to the given duration.
If the duration is zero, the timer is removed (and stopped as needed). If the duration is non-zero, the timer is created if it doesn't exist, or reset if it does.
Click to show internal directories.
Click to hide internal directories.