timex

package
v1.5.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Align

func Align(t time.Time, d time.Duration) time.Time

Align floors time t to the nearest lower multiple of d (e.g., 5m, 1h).

func Jitter

func Jitter(d time.Duration, ratio float64) time.Duration

Jitter multiplies duration by a random factor in [1, 1+ratio]. ratio<0 is treated as 0; ratio>1 is capped at 1.

func NowUTC

func NowUTC() time.Time

NowUTC returns the current time in UTC.

func ParseAny

func ParseAny(layouts []string, s string) (time.Time, error)

ParseAny tries layouts in order to parse the time string.

func Within

func Within(t, start, end time.Time) bool

Within reports whether t is within the closed interval [start, end].

Types

This section is empty.

Jump to

Keyboard shortcuts

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