timex

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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