timex

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Now

func Now() time.Duration

Now 函数返回当前时间相对于initTime的时间间隔(即相对时间)。 这个函数的返回值类型是time.Duration,表示从initTime到当前时间的时间间隔

func ReprOfDuration

func ReprOfDuration(duration time.Duration) string

ReprOfDuration 将给定的时间间隔转换为毫秒为单位的字符串 例子:1500000000 纳秒(等于 1.5 秒)@return 1500.0ms

func Since

func Since(d time.Duration) time.Duration

Since 函数接收一个时间间隔d作为参数,并返回从给定时间间隔d到当前时间的时间差

Types

type FakeTickerInter

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

func NewFakeTicker

func NewFakeTicker() FakeTickerInter

type Ticker

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

func NewTicker

func NewTicker(duration time.Duration) Ticker

Jump to

Keyboard shortcuts

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