timespan

package
v0.0.0-...-9b5cd94 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Span

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

Span represents interval between two times.

func Intersect

func Intersect(left, right Span) *Span

Intersect returns intersect of spans or nil if they don't overlap.

func New

func New(from, to time.Time) Span

New creates new span with given start and end times.

func (*Span) Diff

func (s *Span) Diff(d Span) []Span

Diff returns difference which is in s but not in d.

func (*Span) Duration

func (s *Span) Duration() time.Duration

Duration returns duration of span.

func (*Span) From

func (s *Span) From() time.Time

From returns time at the start of span.

func (*Span) In

func (s *Span) In(v time.Time) bool

In checks if the time moment is in the time span.

func (Span) MarshalJSON

func (s Span) MarshalJSON() ([]byte, error)

func (*Span) To

func (s *Span) To() time.Time

To returns time at the end of span.

func (*Span) UnmarshalJSON

func (s *Span) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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