cronexp.cronexp

This framework provides parser of cron expressions and evaluator of next date and time of triggering parsed cron expressions.

Cron expression consists of 6 required fields separated by white space

Supported fields:

Field Allowed values Special charachters

Seconds 0-59 , - * / Minutes 0-59 , - * / Hours 0-23 , - * / Day-of-month 1-31 , - * / ? Month 1-12 or JAN-DEC , - * / Day-of-week 1-7 or MON-SUN , - * / ?

Months names: JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC Day-of-weeks names: MON,TUE,WED,THU,FRI,SAT,SUN

Charachters:

Asterisk (*): is used for specify all values (eg. 'every minute' in minute field)

Comma (,): is used for to separate items of a list (eg. using "MON,WED,FRI" in the 6th field (day of week) means Mondays, Wednesdays, Fridays)

Hyphen (-): is used for define ranges (eg. 10-30 in 1st field means every second between 10 and 30 inclusive)

Slash (/): is used for define step values, a/x = a, a+x, a+2x, a+3x, ... (eg. 2/4 in hours means list of 2,6,10,14,18,22) '*' mean minimal allowed value (eg. 0 for hours, 1 for months etc)

Question mark (?): is a synonym of '*' for day-of-week and day-of-month fields used to explicitly indicate that days are set with other field

More...

Members

Aliases

Interval
alias Interval = Tuple!(ubyte, "from", ubyte, "to")
Undocumented in source.

Classes

CronException
class CronException

Cron exception

Enums

Range
enum Range
Undocumented in source.

Functions

replaceNames
auto replaceNames(R expr, string names)

Replace names of dows and doms in expression

Manifest constants

cronReg
enum cronReg;
Undocumented in source.
domKeys
enum domKeys;
Undocumented in source.
domReg
enum domReg;
Undocumented in source.
dowKeys
enum dowKeys;
Undocumented in source.
dowNames
enum dowNames;
Undocumented in source.
dowReg
enum dowReg;
Undocumented in source.
hrsKeys
enum hrsKeys;
Undocumented in source.
hrsReg
enum hrsReg;
Undocumented in source.
minKeys
enum minKeys;
Undocumented in source.
minReg
enum minReg;
Undocumented in source.
monKeys
enum monKeys;
Undocumented in source.
monReg
enum monReg;
Undocumented in source.
moyNames
enum moyNames;
Undocumented in source.
secKeys
enum secKeys;
Undocumented in source.
secReg
enum secReg;
Undocumented in source.

Mixins

__anonymous
mixin RegexNamesEnum!("Sec", "list", "range", "seq", "any")
Undocumented in source.
__anonymous
mixin RegexNamesEnum!("Min", "list", "range", "seq", "any")
Undocumented in source.
__anonymous
mixin RegexNamesEnum!("Hrs", "list", "range", "seq", "any")
Undocumented in source.
__anonymous
mixin RegexNamesEnum!("Dom", "list", "range", "seq", "undef", "any")
Undocumented in source.
__anonymous
mixin RegexNamesEnum!("Mon", "list", "range", "seq", "listN", "rangeN", "seqN", "any")
Undocumented in source.
__anonymous
mixin RegexNamesEnum!("Dow", "list", "range", "seq", "listN", "rangeN", "seqN", "undef", "any")
Undocumented in source.

Mixin templates

RegexNamesEnum
mixintemplate RegexNamesEnum(string Name, Fields...)
Undocumented in source.

Structs

CronExpr
struct CronExpr

Struct containing parsed cron expression

Detailed Description

NOTES: - If both the 'Day-of-month' and 'Day-of-week' fields are restricted (aren't '*'), next correct time will be when both(!) fields match the conditions. For example: * * * 13 * FRI expression will be satisfied only on friday 13th. - Ranges can be overflowing, it means range 'NOV-FEB' (NOV > FEB) will expand in NOV,DEC,JAN,FEB

Meta

Authors

Maxim Tyapkin

License

This software is licensed under the terms of the BSD 3-clause license. The full terms of the license can be found in the LICENSE.md file.