Documentation
¶
Overview ¶
Package cron parses standard five-field cron expressions and works out when they next fire, in UTC or an IANA time zone.
Fields are minute, hour, day of month, month and day of week. Each takes *, a number, a range (1-5), a list (1,3,5) and a step (*/15 or 10-50/10). Months and weekdays also take three-letter names (JAN, MON), and 7 is Sunday as well as 0. The macros @yearly, @annually, @monthly, @weekly, @daily, @midnight and @hourly are accepted.
As in Vixie cron, when both day of month and day of week are restricted (neither starts with *), a day matches if either does.
Daylight saving: each wall-clock time fires at most once. A time that does not exist because the clocks went forward fires when it would have been, shifted by the jump (02:30 becomes 03:30 when 02:00 jumps to 03:00). A time that happens twice because the clocks went back fires the first time only.
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 bound to a time zone.
func Parse ¶
Parse reads a five-field expression. tz is an IANA zone name such as Europe/London; empty means UTC.
func (*Schedule) Next ¶
Next returns the first firing strictly after t, or the zero time if there is none within nine years.