duration

package
v0.36.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package duration copied as it is from github.com/senseyeio/duration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration struct {
	// If Inf is true, the other components should be ignored
	Inf bool
	// Date component
	Year  int
	Month int
	Week  int
	Day   int
	// Time Component
	Hour   int
	Minute int
	Second int
}

Duration represents an ISO8601 duration with Rill-specific extensions. See ParseISO8601 for details.

func ParseISO8601

func ParseISO8601(from string) (Duration, error)

ParseISO8601 parses an ISO8601 duration as well as some Rill-specific extensions. (Section 3.7 of the standard supposedly allows extensions that do not interfere with the standard.) The only current extension is "inf", for representing an unbounded duration of time.

func (Duration) Add added in v0.36.0

func (d Duration) Add(t time.Time) time.Time

Add adds the duration to a timestamp

func (Duration) Sub added in v0.36.0

func (d Duration) Sub(t time.Time) time.Time

Sub subtracts the duration from a timestamp

Jump to

Keyboard shortcuts

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