timeutil

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: Apache-2.0 Imports: 3 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Period

type Period struct {
	Start time.Time
	End   time.Time
}

Period is a span of time from Start to End

type Periodic

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

Periodic keeps track of a repeating period of time

func ParsePeriodic

func ParsePeriodic(start, duration string) (*Periodic, error)

ParsePeriodic returns a Periodic specified as a start and duration.

func (*Periodic) DurationToStart

func (pc *Periodic) DurationToStart(ref time.Time) time.Duration

DurationToStart returns the duration between the supplied time and the start of Periodic's relevant period. If we're in a period, a value <= 0 is returned, indicating how deep into period we are. If we're outside a period, a value > 0 is returned, indicating how long before the next period starts.

func (*Periodic) Next

func (pc *Periodic) Next(ref time.Time) (p *Period)

Next returns Periodic's next Period occurrence relative to ref.

func (*Periodic) Previous

func (pc *Periodic) Previous(ref time.Time) (p *Period)

Previous returns Periodic's previous Period occurrence relative to ref.

Jump to

Keyboard shortcuts

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