Documentation ¶
Index ¶
- Constants
- func DurationToRelative(d time.Duration) string
- func GetTimeMono(t time.Time) int64
- func MonoSub(mono1, mono2 int64) time.Duration
- func Monotonic() int64
- func NowString() string
- func ParseDuration(s string) (time.Duration, error)
- func SecondsToString(seconds int) string
- func SleepSeconds[Number number](seconds Number)
- func StartMono() int64
- func TimeFromUnix(sec int64) time.Time
- func TimeFromUnixMicro(msec uint64) time.Time
- func TimeFromUnixNano(nsec uint64) time.Time
- func TimeString() string
- func TimeToRelative(d time.Time) string
- func TodayString() string
Constants ¶
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 GetTimeMono ¶ added in v0.4.36
GetTimeMono returns the mono part of t's monotonic clock It returns 0 for a missing reading.
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 ParseDuration ¶
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 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 TimeFromUnixMicro ¶
TimeFromUnixMicro 使用微秒级时间戳获取时间对象
func TimeFromUnixNano ¶
TimeFromUnixNano 使用纳秒级时间戳获取时间对象
func TimeToRelative ¶
Types ¶
This section is empty.