timer

package
v0.0.0-...-17244d7 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimeSpec

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

TimeSpec holds times.

func GetMonotonicTime

func GetMonotonicTime() TimeSpec

GetMonotonicTime returns the monotonic time, used when the time should be effected by time adjust, like timer. according to the sources of golang, the time.Now() is the CLOCK_REALTIME which will be affected by discontinuous jumps in the system time.

func (TimeSpec) MicroSeconds

func (ts TimeSpec) MicroSeconds() int64

MicroSeconds returns milliseconds

func (TimeSpec) Milliseconds

func (ts TimeSpec) Milliseconds() int64

Milliseconds returns the milliseconds

func (TimeSpec) NanoSeconds

func (ts TimeSpec) NanoSeconds() int64

NanoSeconds returns nanoseconds

func (TimeSpec) Seconds

func (ts TimeSpec) Seconds() int64

Seconds returns the seconds.

func (TimeSpec) String

func (ts TimeSpec) String() string

type Timer

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

Timer is used for reporting rate.

func NewTimer

func NewTimer() *Timer

NewTimer creates a new timer.

func (*Timer) Continue

func (timer *Timer) Continue()

Continue a stopped timer.

func (*Timer) Elapsed

func (timer *Timer) Elapsed() time.Duration

Elapsed returns the duration from start to end if timer is stopped. Elapsed returns the duration from start to now if timer is not stopped.

func (*Timer) Reset

func (timer *Timer) Reset()

Reset a timer.

func (*Timer) Start

func (timer *Timer) Start()

Start the timer.

func (*Timer) Stop

func (timer *Timer) Stop()

Stop timer.

Jump to

Keyboard shortcuts

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