timer

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MPL-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

Jump to

Keyboard shortcuts

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