Janet 1.39.1-e9c6678 Documentation
(Other Versions:
1.38.0
1.37.1
1.36.0
1.35.0
1.34.0
1.31.0
1.29.1
1.28.0
1.27.0
1.26.0
1.25.1
1.24.0
1.23.0
1.22.0
1.21.0
1.20.0
1.19.0
1.18.1
1.17.1
1.16.1
1.15.0
1.13.1
1.12.2
1.11.1
1.10.1
1.9.1
1.8.1
1.7.0
1.6.0
1.5.1
1.5.0
1.4.0
1.3.1
)
cron
Timer library for interfacing with the UNIX crontab format.
The cron format support is based on the unix cron syntax, with an optional seconds field. Each field can be a comma separated list of individual values or a range of values.
A range has three variants as follows:
- Two values with a "-" between them, optionally followed by a "/" and a step value.
- An asterisk ("*") followed by a "/" and a step value. This implies every "step" value.
- A single value followed by a "/" and a step value. This implies every "step" value starting with the single value. I.e., 2/3 implies every 3 units from 2 to max units.
A single asterisk ("*") can be used to denote all possible values.
The fields:
- minutes: 0-5
- hours: 0-2
- day of month: 1-3
- month: 1-12. Also allowed are the following month codes in any case jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec
- day of week: 0-7, where 0 or 7 is sunday, monday is 1, etc. allows the following day codes (any case) sun,mon,tue,wed,thu,fri,sat
- seconds (optional): 0-5
Cron schedules are represented as tuples of 7 values, a string representation, followed by 6 bitmaps representing matching timestamps. Bitmaps are represented as any byte sequence.
[string-rep minutes hours day-of-month month day-of-week seconds]
Note that we have second precision here as opposed to minute precision.
Reference
cron/check cron/next-timestamp cron/parse-cron
cron/check function source
(check cron &opt time local) Check if a given time matches a cron specifier.
cron/next-timestamp function source
(next-timestamp cron &opt time local) Given a cron schedule, get the next instance on the cron tab after time
cron/parse-cron function source
(parse-cron str) Parse a cron string into a valid cron schedule object