timex

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffMS added in v0.4.3

func DiffMS(a, b time.Duration) int64

func DiffS added in v0.4.3

func DiffS(a, b time.Duration) int64

func Now

func Now() time.Duration

当前相对原点的时差,因为全系统都是相对时间,你可以认为这个时差就是当前时间

func NowDiff added in v0.4.3

func NowDiff(d time.Duration) time.Duration

时间差+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 当前时间和传入的指定时间之间的时间差(这里比较绕,都是相对的概念)

func NowDiffMS added in v0.4.3

func NowDiffMS(d time.Duration) int64

时间差毫秒

func NowDiffS added in v0.4.3

func NowDiffS(d time.Duration) int64

时间差秒

func ToDuration added in v0.4.3

func ToDuration(tm *time.Time) time.Duration

func ToStringMS added in v0.4.3

func ToStringMS(dur time.Duration) string

func ToTime

func ToTime(d time.Duration) time.Time

将指定的相对时间转成 真实的 time.Time 类型

Types

type FakeTicker

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

func NewFakeTicker

func NewFakeTicker() FakeTicker

type Ticker

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

func NewTicker

func NewTicker(d time.Duration) Ticker

Jump to

Keyboard shortcuts

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