MCPcopy Index your code
hub / github.com/coder/coder / TimeRange

Function TimeRange

coderd/schedule/cron/cron.go:89–95  ·  view source on GitHub ↗

TimeRange parses a Schedule from a cron specification interpreted as a continuous time range. For example, the expression "* 9-18 * * 1-5" represents a continuous time span from 09:00:00 to 18:59:59, Monday through Friday. The specification consists of space-delimited fields in the following order

(raw string)

Source from the content-addressed store, hash-verified

87// Unlike standard cron, this function interprets the input as a continuous active period
88// rather than discrete scheduled times.
89func TimeRange(raw string) (*Schedule, error) {
90 if err := validateTimeRangeSpec(raw); err != nil {
91 return nil, xerrors.Errorf("validate time range schedule: %w", err)
92 }
93
94 return parse(raw)
95}
96
97func parse(raw string) (*Schedule, error) {
98 // If schedule does not specify a timezone, default to UTC. Otherwise,

Callers 1

MatchesCronFunction · 0.92

Calls 3

validateTimeRangeSpecFunction · 0.85
parseFunction · 0.70
ErrorfMethod · 0.45

Tested by

no test coverage detected