vegatime

package
v0.79.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(t time.Time) string

Format format the time using the time.RFC3339Nano formatting.

func Now

func Now() time.Time

Now return the current time in UTC timezone.

func Parse

func Parse(t string) (time.Time, error)

Parse parse a string expected to be a time in the time.RFC3339Nano format.

func RoundToNearest

func RoundToNearest(t time.Time, interval types.Interval) time.Time

RoundToNearest round an actual time to the nearest interval.

func SetNowFunc

func SetNowFunc(f func() time.Time)

SetNowFunc exists for testing purpose e.g: set the vegatime.Now function to return a specific time

vegatime.SetNowFunc(func() time.T { vegatime.Unix(123423, 0) })

reset the vegatime.Now function

vegatime.SetNowFunc(nil)

this will reset the vegatime.Now function to use time.Now() again.

func Unix

func Unix(sec int64, nsec int64) time.Time

Unix create a new time from sec and nsec in UTC timezone.

func UnixNano

func UnixNano(nsec int64) time.Time

UnixNano equivalent to time.Unix(sec, nsec) but to be used with the result of time.Time{}.UnixNano() in UTC timezone.

Types

This section is empty.

Jump to

Keyboard shortcuts

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