time_window

package
v0.0.0-...-d0a4a9f Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimeWindow

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

TimeWindow specifies a set of time windows on each day of the week in which a roller is allowed to upload rolls.

func Parse

func Parse(s string) (*TimeWindow, error)

Parse returns a TimeWindow instance based on the given string. Times are interpreted as GMT. The accepted format is as follows:

FullWindowExpr      = SingleDayWindowExpr(;SingleDayWindowExpr)*
SingleDayWindowExpr = DayRangesExpr TimeExpr-TimeExpr
DayRangesExpr       = (*|DayRangeExpr(,DayRangeExpr)*)
DayRangeExpr        = DayExpr(-DayExpr)?
DayExpr             = (Su|M|Tu|W|Th|F|Sa)
TimeExpr            = \d\d:\d\d

Examples:

Day range:                         M-F 09:00-17:00
Every day:                         * 00:00-23:59
Multiple days, same time:          Sa,M-W 08:00-09:00
Multiple days, different times:    Sa 08:00-09:00; M-W 12:00-03:00
Wrap around to next day:           M-F 22:00-02:00

func (*TimeWindow) Test

func (w *TimeWindow) Test(t time.Time) bool

Test returns true iff the given time.Time occurs within the TimeWindow.

Jump to

Keyboard shortcuts

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