larzcron
Cron expressions + scheduler.
A full cron-expression parser (ranges, steps, names, macros, Vixie DOM/DOW semantics) plus an in-process scheduler for cron and interval jobs.
larzscript pkg install cron
What you get
- Full cron parser
- next/previous run times
- Interval + cron jobs
- In-process scheduler
Try it
import "cron" as cron
let job = cron.parse("*/15 9-17 * * 1-5")
let now = 1785657600
print(cron.next_run(job, now))
let s = cron.scheduler()
let log = []
cron.every(s, 60, fn() { log.push("a minute passed") })
cron.tick(s, now)
cron.tick(s, now + 60)
print(log)Output
1785747600 [a minute passed]
Why it's in the Larz Stack
larzcron is a real Larzscript package (larzscript pkg install cron) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.