timer

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogTimeElapsed added in v0.3.1

func LogTimeElapsed(start time.Time, task string)

LogTimeElapsed logs the amount of time since this function was defered at the debug level

Types

type Timer

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

func NewTimer added in v0.3.0

func NewTimer() *Timer

func (*Timer) Start

func (t *Timer) Start(interval time.Duration, sync func())

Start calls sync() every interval. if sync() runs long, the next interval will not be started until it completes. if intervals are missed they will be skipped, so sync() is free to run as long as it needs to

func (*Timer) Stop

func (t *Timer) Stop()

Stop should be called only once. It waits for the sync function to exit before returning

Jump to

Keyboard shortcuts

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