Documentation
¶
Overview ¶
Package cron parses standard five-field cron expressions and computes their next run times.
An expression has five fields separated by spaces: minute (0-59), hour (0-23), day of month (1-31), month (1-12 or JAN-DEC), and day of week (0-7 or SUN-SAT, where both 0 and 7 mean Sunday). Each field is "*", a value, a range "a-b", or a list of those separated by commas, and any of them may carry a step "/n". When both day fields are restricted, a day matches if either matches, as in classic cron. The macros @yearly, @annually, @monthly, @weekly, @daily, @midnight, and @hourly are also accepted.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Schedule ¶
type Schedule struct {
// contains filtered or unexported fields
}
Schedule is a parsed cron expression.
func (*Schedule) Next ¶
Next returns the first time after t that the schedule matches, in t's location. It fails if the schedule never matches, such as on February 31.
The schedule is matched against the wall clock, so daylight saving time behaves as in classic cron: a time skipped when clocks go forward runs right after the jump, and a time repeated when clocks go back runs once.