https://github.com/syaiful6/cron.ml
Cron data structure, parser and schedule explorer for OCaml
https://github.com/syaiful6/cron.ml
Last synced: 8 months ago
JSON representation
Cron data structure, parser and schedule explorer for OCaml
- Host: GitHub
- URL: https://github.com/syaiful6/cron.ml
- Owner: syaiful6
- License: mit
- Created: 2024-09-07T08:39:48.000Z (almost 2 years ago)
- Default Branch: develop
- Last Pushed: 2024-09-15T05:15:53.000Z (over 1 year ago)
- Last Synced: 2024-09-15T09:26:34.263Z (over 1 year ago)
- Language: OCaml
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cron
Cron data structure, Angstrom parser and schedule explorer for OCaml.
```ocaml
(** create a cron schedule and test again current timestamp *)
let schedule = Option.get_ok @@ Cron.Parser.parse_cron_schedule "*/2 * * * *"
let now = Ptime_clock.now ()
if Cron.Schedule.matches schedule now
then
print_endline "schedule matches"
(** run your functions/tasks here *)
else
(** your cron schedule not matches against current time! DO Nothing *)
print_endline "schedule not matches"
```