Help us shape the future of Go! Take the 2026 Go Developer Survey

interval

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: AGPL-3.0, BSD-2-Clause, ISC Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Century = time.Duration(100 * 365 * 24 * time.Hour)
View Source
var Infinity = time.Unix(1<<63-62135596801, 999999999)
View Source
var ZeroTime = time.Unix(0, 0)

https://stackoverflow.com/questions/25065055/what-is-the-maximum-time-time-in-go

Functions

func Comparator

func Comparator(a, b interface{}) int

Comparator function (sort by IDs)

func Sort

func Sort(intervals *[]Interval)

Sort orders intervals by start time (and then by end time to split a tie on start time)

Types

type Interval

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

func Invert

func Invert(intervals []Interval) []Interval

Invert sorts, merges and then inverts the given intervals

func Merge

func Merge(intervals []Interval) []Interval

Merge combines any overlapping intervals

Jump to

Keyboard shortcuts

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