timing.cron
cron-element-parserer
(cron-element-parserer element [min- max- at])Parses CRON like element. Elements are in form 1-25/0 1,5,40/10 1,20,40 20-40/5 */2 L, L-3, 15W, LW (day-in-month) FRI#3, 5L (day-of-week) etc.
days-in-month
(days-in-month year month)Returns the number of days in a month, accounting for leap years.
next-timestamp
(next-timestamp timestamp cron-string)Return next valid timestamp after input timestamp. If there is no such timestamp, than nil is returned.
normalize-cron-string
(normalize-cron-string cron-record)Normalizes a cron string by right-padding missing fields with ‘*’. - “*/10” -> “*/10 * * * * *” - “0 */5” -> “0 */5 * * * *”
Also supports @ shortcuts like @daily, @weekly, etc.
parse-cron-string
(parse-cron-string cron-record)Parses CRON string e.g.
“0,3,20/20 0 0 3-20/10 * * *”
Short forms are auto-padded with ‘*’: - “*/10” -> “*/10 * * * * *” (every 10 seconds) - “0 */5” -> “0 */5 * * * *” (every 5 minutes at second 0)
Also supports @ shortcuts: - @daily, @weekly, @monthly, @yearly, @hourly
If record is not valid assertion will be thrown. Returned data is sequence of cron-mappings that define what time is valid to execute Job.
valid-timestamp?
(valid-timestamp? timestamp cron-string)Given a timestamp and cron definition function returns true if timestamp satisfies cron definition.