furytime

package
v0.0.0-...-589da53 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT 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 furytime.Now function to return a specific time

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

reset the furytime.Now function

furytime.SetNowFunc(nil)

this will reset the furytime.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