extime

package
v0.4.38 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Nanosecond  = time.Nanosecond
	Microsecond = time.Microsecond
	Millisecond = time.Millisecond
	Second      = time.Second
	Minute      = time.Minute
	Hour        = time.Hour
	Day         = 24 * time.Hour
)

Variables

This section is empty.

Functions

func DurationToRelative added in v0.4.37

func DurationToRelative(d time.Duration) string

func GetTimeMono added in v0.4.36

func GetTimeMono(t time.Time) int64

GetTimeMono returns the mono part of t's monotonic clock It returns 0 for a missing reading.

func MonoSub added in v0.4.36

func MonoSub(mono1, mono2 int64) time.Duration

MonoSub returns the duration mono1-mono2.

func Monotonic added in v0.4.34

func Monotonic() int64

Monotonic returns the system monotonic clock, reported in nanoseconds.

Warning: though sometimes the return value looks like a Unix nanosecond timestamp, it is not. Only use it to compute time intervals.

func NowString

func NowString() string

NowString 当前时间转换为 200601021504(年月日时分)的格式

func ParseDuration

func ParseDuration(s string) (time.Duration, error)

ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w".

func SecondsToString

func SecondsToString(seconds int) string

func SleepSeconds added in v0.4.25

func SleepSeconds[Number number](seconds Number)

func StartMono added in v0.4.37

func StartMono() int64

StartMono returns the start monotonic time of the program

func TimeFromUnix

func TimeFromUnix(sec int64) time.Time

TimeFromUnix 使用秒级时间戳获取时间对象

func TimeFromUnixMicro

func TimeFromUnixMicro(msec uint64) time.Time

TimeFromUnixMicro 使用微秒级时间戳获取时间对象

func TimeFromUnixNano

func TimeFromUnixNano(nsec uint64) time.Time

TimeFromUnixNano 使用纳秒级时间戳获取时间对象

func TimeString

func TimeString() string

TimeString 当前时间转换为 150405(时分秒)的格式

func TimeToRelative

func TimeToRelative(d time.Time) string

func TodayString

func TodayString() string

TodayString 当前时间转换为 20060102(年月日)的格式

Types

This section is empty.

Jump to

Keyboard shortcuts

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