timeutils

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationString added in v0.3.0

func DurationString(d time.Duration) string

func ParseDuration added in v0.1.0

func ParseDuration(str string) (time.Duration, error)

Types

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

Iterator achieves a loop for a specified period of time

func NewIterator

func NewIterator(startAt, endAt time.Time, tick time.Duration) *Iterator

NewIterator create Iterator

func (*Iterator) HasNext

func (iter *Iterator) HasNext() bool

HasNext is a loop continuation condition

func (*Iterator) Next

func (iter *Iterator) Next() (time.Time, time.Time)

Next returns the current rolling window and recommends Iterator to the next window

func (*Iterator) SetEnableOverWindow

func (iter *Iterator) SetEnableOverWindow(flag bool)

SetEnableOverWindow affects the Iterator's end condition and specifies whether to allow the end time of the rolling window to exceed the end time of the specified period.

Jump to

Keyboard shortcuts

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