time

package
v0.0.0-...-8846729 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllTime

func AllTime() *time.Period

func CompareAscending

func CompareAscending(t1, t2 *timestamppb.Timestamp) int

CompareAscending returns -1 if t1 is before t2, 1 if t1 is after t2 and 0 if t1 is equal to t2

func PeriodBefore

func PeriodBefore(t *timestamppb.Timestamp) *time.Period

func PeriodBetween

func PeriodBetween(t1, t2 *timestamppb.Timestamp) *time.Period

func PeriodOnOrAfter

func PeriodOnOrAfter(t *timestamppb.Timestamp) *time.Period

func PeriodsConnected

func PeriodsConnected(p1, p2 *time.Period) bool

PeriodsConnected returns true if there exists a (possibly empty) Period that is enclosed by both p1 and p2

For example

  • `[2, 4)` and `[5, 7)` are not connected
  • `[2, 4)` and `[3, 5)` are connected, because both enclose `[3, 4)`
  • `[2, 4)` and `[4, 6)` are connected, because both enclose the empty period `[4, 4)`

func PeriodsIntersect

func PeriodsIntersect(p1, p2 *time.Period) bool

PeriodsIntersect returns true if there exists a non-empty Period that is enclosed by both p1 and p2

For example

  • `[2, 4)` and `[5, 7)` do not intersect
  • `[2, 4)` and `[3, 5)` intersect, because both enclose `[3, 4)` which is non-empty
  • `[2, 4)` and `[4, 6)` do not intersect, because both enclose the empty period `[4, 4)`

Types

This section is empty.

Directories

Path Synopsis
Package clock contains the Clock interface, an abstraction over the functions in the standard time package.
Package clock contains the Clock interface, an abstraction over the functions in the standard time package.

Jump to

Keyboard shortcuts

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