timing

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const Format = "2006-01-02.15-04-05"

Format contains a time format string for use in combination with the rounded time functions. It is easy to read and omits sub-second resolution.

Variables

This section is empty.

Functions

func GetUTCDay

func GetUTCDay(date time.Time) time.Time

Creates and returns a time.Time corresponding to the start of the UTC day containing the given date.

func GetUTCHour

func GetUTCHour(date time.Time) time.Time

Creates and returns a time.Time corresponding to the start of the UTC hour containing the given date.

func JitterInterval

func JitterInterval(interval time.Duration) time.Duration

JitterInterval returns a duration that some value between the interval and 2x the interval.

func RoundPartOfDay

func RoundPartOfDay(n int) time.Time

RoundPartOfDay produces a time value with the hour value rounded down to the most recent interval.

func RoundPartOfHour

func RoundPartOfHour(n int) time.Time

RoundPartOfHour produces a time value with the minute value rounded down to the most recent interval.

func RoundPartOfMinute

func RoundPartOfMinute(n int) time.Time

RoundPartOfMinute produces a time value with the second value rounded down to the most recent interval.

func UnixMilli

func UnixMilli(t time.Time) int64

UnixMilli returns t as a Unix time, the number of nanoseconds elapsed since January 1, 1970 UTC. The result is undefined if the Unix time in nanoseconds in cannot be represented by an int64 (a date before the year 1678 or after 2262). Note that this means the result of calling UnixMilli on the zero Time on the zero Time is undefined. The result does not depend on the location associated with t.

Types

This section is empty.

Jump to

Keyboard shortcuts

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