timex

package
v1.2.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 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.

func Time

func Time() time.Time

Time returns current time, the same as time.Now().

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