time

package
v0.27.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDateUTC

func FormatDateUTC(t time.Time) string

FormatDateUTC returns t in UTC as a string with the format YYYY-MM-DD.

Types

type Range

type Range struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
}

type WindowIterator

type WindowIterator struct {
	Cursor clock.SimpleIntervalClock
	End    time.Time
}

WindowIterator iterates through windows of a range of time. Must be initialized with NewWindowIterator().

func NewWindowIterator

func NewWindowIterator(tr Range, window time.Duration) (*WindowIterator, error)

NewWindowIterator returns an initialized *WindowIterator.

func (*WindowIterator) More

func (i *WindowIterator) More() bool

More() returns true if Next() has more to return.

func (*WindowIterator) Next

func (i *WindowIterator) Next() (Range, error)

Next() returns a time range covering the next window of time. The start time is inclusive and the end time is exclusive. Returns an error if More() returns false.

Jump to

Keyboard shortcuts

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