timex

package
v0.0.0-...-9a9fc0b Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Now

func Now() time.Duration

Now returns a relative time duration since initTime, which is not important. The caller only needs to care about the relative value.

func ReprOfDuration

func ReprOfDuration(duration time.Duration) string

ReprOfDuration returns the string representation of given duration in ms.

func Since

func Since(d time.Duration) time.Duration

Since returns a diff since given d.

Types

type FakeTicker

type FakeTicker interface {
	Ticker
	Done()
	Tick()
	Wait(d time.Duration) error
}

FakeTicker interface is used for unit testing.

func NewFakeTicker

func NewFakeTicker() FakeTicker

NewFakeTicker returns a FakeTicker.

type Ticker

type Ticker interface {
	Chan() <-chan time.Time
	Stop()
}

Ticker interface wraps the Chan and Stop methods.

func NewTicker

func NewTicker(d time.Duration) Ticker

NewTicker returns a Ticker.

Jump to

Keyboard shortcuts

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