microtime

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 3 Imported by: 0

README

GoDoc

microtime

Just microtime functions.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromBytes

func FromBytes(v []byte) time.Time

FromBytes converts a given binary array value to time.Time, expecting to only find values after 1970-01-01.

func FromInt64

func FromInt64(tm int64) time.Time

FromInt64 converts a given int64 value back to time.Time.

func FromUint64

func FromUint64(tm uint64) time.Time

FromUint64 converts a given uint64 value back to time.Time.

func Stamp

func Stamp() uint64

Stamp returns a uint64 timestamp in microsecond that is unique and ever increasing, so that even if called multiple times in the same millisecond each call will return a different and increasing value.

This can be safely called from multiple threads, and does not lock.

func ToBytes

func ToBytes(t time.Time) []byte

ToBytes converts time to a binary value suitable for sorting. This is made to work with dates >=1970-01-01 and will not work properly for data prior to that.

func ToInt64

func ToInt64(t time.Time) int64

ToInt64 will return a int64 version of the passed time, with negative values corresponding to anything prior to January 1st 1970 UTC. This can be useful if working with an order dataset (in order to get a proper ordering, offsetting the set's start date will be needed).

func ToUint64

func ToUint64(t time.Time) uint64

ToUint64 will return a uint64 version of the passed time. It is assumed time will always be after 1970, and no check is performed to see if it might actually be in the past. If you need to handle values in the past, use ToInt64.

Types

This section is empty.

Jump to

Keyboard shortcuts

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