steppedtime

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Nanosecond  = time.Nanosecond
	Microsecond = time.Microsecond
	Millisecond = time.Millisecond
	Second      = time.Second
	Minute      = time.Minute
	Hour        = time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

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

func NewClock

func NewClock() *Clock

func (*Clock) After

func (c *Clock) After(d Duration) <-chan Time

func (*Clock) AfterFunc

func (c *Clock) AfterFunc(d Duration, f func()) *Timer

func (*Clock) Hours

func (*Clock) Hours(n float64) Duration

func (*Clock) Microseconds

func (*Clock) Microseconds(n int64) Duration

func (*Clock) Milliseconds

func (*Clock) Milliseconds(n int64) Duration

func (*Clock) Minutes

func (*Clock) Minutes(n float64) Duration

func (*Clock) Nanoseconds

func (*Clock) Nanoseconds(n int64) Duration

func (*Clock) NewTicker

func (c *Clock) NewTicker(d Duration) *Ticker

func (*Clock) NewTimer

func (c *Clock) NewTimer(d Duration) *Timer

func (*Clock) Now

func (c *Clock) Now() (now Time)

func (*Clock) ParseDuration

func (*Clock) ParseDuration(s string) (Duration, error)

func (*Clock) Seconds

func (*Clock) Seconds(n float64) Duration

func (*Clock) Set

func (c *Clock) Set(now Time)

If any timers are active, a value of `now` earlier than the previous setting may lead to undefined behavior.

func (*Clock) Since

func (c *Clock) Since(t Time) Duration

func (*Clock) Sleep

func (c *Clock) Sleep(d Duration)

func (*Clock) Step

func (c *Clock) Step(dt Duration)

If any timers are active, a negative value for dt may lead to undefined behavior.

func (*Clock) Tick

func (c *Clock) Tick(d Duration) <-chan Time

func (*Clock) Until

func (c *Clock) Until(t Time) Duration

type Duration

type Duration = time.Duration

time's Duration is sufficiently simple to reuse here

type Ticker

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

func (*Ticker) C

func (t *Ticker) C() <-chan Time

func (*Ticker) Reset

func (t *Ticker) Reset(d Duration)

func (*Ticker) Stop

func (t *Ticker) Stop()

type Time

type Time int64

The number of nanoseconds since the start of the clock

func (Time) Add

func (t Time) Add(d Duration) Time

func (Time) After

func (t Time) After(u Time) bool

func (Time) Before

func (t Time) Before(u Time) bool

func (Time) Compare

func (t Time) Compare(u Time) int

func (Time) Equal

func (t Time) Equal(u Time) bool

func (Time) IsZero

func (t Time) IsZero() bool

func (Time) Sub

func (t Time) Sub(u Time) Duration

type Timer

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

func (*Timer) C

func (t *Timer) C() <-chan Time

func (*Timer) Reset

func (t *Timer) Reset(d Duration) (active bool)

func (*Timer) Stop

func (t *Timer) Stop() (active bool)

Jump to

Keyboard shortcuts

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