timeutils

package
v2.16.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertMicrosecondsToUnixTime

func ConvertMicrosecondsToUnixTime(timeInMicroseconds int64) time.Time

ConvertMicrosecondsToUnixTime converts the UTC time in microseconds to a time.Time struct (unix time)

func StringTimestampToHumanReadableFormat

func StringTimestampToHumanReadableFormat(unixTimestampAsString string) (humanReadable string, parsedTimestamp int64, err error)

StringTimestampToHumanReadableFormat parses and sanity-checks a unix timestamp as string and returns it as int64 and a human-readable representation of it

func TimeAnchor

func TimeAnchor() time.Time

TimeAnchor gives you back a timestamp of the first caller that ever called this function

Types

type TimelineProvider

type TimelineProvider interface {

	// Now Returns the current (client-side) time in UTC
	Now() time.Time

	// Sleep suspends the current goroutine for the specified duration
	Sleep(duration time.Duration)
}

TimelineProvider abstracts away the time.Now() and time.Sleep(time.Duration) functions to make code unit-testable Whenever you need to get the current time, or want to pause the current goroutine (sleep), please consider using this interface

func NewTimelineProvider

func NewTimelineProvider() TimelineProvider

NewTimelineProvider creates a new TimelineProvider

Jump to

Keyboard shortcuts

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