match

package
Version: v1.7.2-0...-f49580b Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package match provides functionality to find matching times. This is the core logic of sleepto.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Next

func Next(start time.Time, c Condition) time.Time

Next finds the next time the passed condition matches. Returns an empty time.Time when no possible match can be found. This can only happen when there is no future year condition. Use .IsZero() to test if result is empty.

Types

type Condition

type Condition struct {
	Year    []int
	Month   []time.Month
	Day     []int // 1 to 31
	Weekday []time.Weekday
	Hour    []int // 0 to 23
	Minute  []int // 0 to 59
	Second  []int // 0 to 59
}

Condition is used to match a time. All fields are optional and can be used in any combination. For each field one value of the list has to match to find a match for the condition.

Source Files

Jump to

Keyboard shortcuts

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