mytimer

package
v1.80.5 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func = func() TimeValue

type TimeValue

type TimeValue = time.Time

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

Very common pattern I have in my code, a timer that coordinates resets from the callback function, externally, and tracks when it's due. Only one instance of the timer callback can be running at a time, and that callback is responsible for also returning the next delay.

func (*Timer) Init

func (me *Timer) Init(first TimeValue, f Func)

func (*Timer) Update

func (me *Timer) Update(when time.Time)

Resets if the timer func hasn't fired.

func (*Timer) When

func (me *Timer) When() time.Time

Jump to

Keyboard shortcuts

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