Live data from Hacker News

Show HN: Cronexpr, a Rust library to parse and iter crontab expression

docs.rs

31–36 of 36 posts

Re: Show HN: Cronexpr, a Rust library to parse and iter crontab expression

#31
post #13
post #12

Earlier quoted context omitted.

This sounds great, if i could trust it to get it right 100% of the time.

With the right harness around it you could trust it. Set it up so that it takes your input, generates the cron expression, then uses a deterministic cron library to spit out a summary of what that expression does plus a list of next upcoming instances. That should give you all the information you need to determine if it got the right expression.

You think it would work to just pipe that description and next occurrences and ask an llm if it matches the intended prompt?

Re: Show HN: Cronexpr, a Rust library to parse and iter crontab expression

#32
post #13

Earlier quoted context omitted.

With the right harness around it you could trust it. Set it up so that it takes your input, generates the cron expression, then uses a deterministic cron library to spit out a summary of what that expression does plus a list of next upcoming instances. That should give you all the information you need to determine if it got the right expression.

You think it would work to just pipe that description and next occurrences and ask an llm if it matches the intended prompt?

No, that still leaves a small probability of something weird happening - and since it's a small probability you might not ever spot it in your own testing.

In this case I think it's better to run known, deterministic code that can turn a crontab into a clear explanation.

Re: Show HN: Cronexpr, a Rust library to parse and iter crontab expression

#33
post #13
post #12

Earlier quoted context omitted.

This sounds great, if i could trust it to get it right 100% of the time.

With the right harness around it you could trust it. Set it up so that it takes your input, generates the cron expression, then uses a deterministic cron library to spit out a summary of what that expression does plus a list of next upcoming instances. That should give you all the information you need to determine if it got the right expression.

Wow. The things people will do to avoid learning cron syntax

Re: Show HN: Cronexpr, a Rust library to parse and iter crontab expression

#35
post #4

Earlier quoted context omitted.

You're welcome! As described in the "Why do you create this crate?" section, I actually started this domain only a few weeks ago. So I experienced how those tribal rules can be confusing and hard to search over the Internet the understand their semantic. And when I sorted out the parse structure [1] and finished the extensions [2][3], I believe I should write it down for others (and future me) :D [1] https://github.c…

Is there a comparison to other cron parsing libraries like Saffron? https://github.com/cloudflare/saffron

Croner has a table for the syntax supported by it and saffron [1], you can compare it with the one cronexpr supported.

[1] https://github.com/hexagon/croner-rust?tab=readme-ov-file#wh...

As supported in [2],

> There are several good candidates like croner and saffron, but they are not suitable for my use case. Both of them do not support defining timezone in the expression which is essential to my use case. Although croner support specific timezone later when matching, the user experience is quite different. Also, the syntax that croner or saffron supports is subtly different from my demand. > > Other libraries are unmaintained or immature to use. > > Last, most candidates using chrono to processing datetime, while I’d prefer to extend the jiff ecosystem.

[2] https://docs.rs/cronexpr/latest/cronexpr/#why-do-you-create-...

Re: Show HN: Cronexpr, a Rust library to parse and iter crontab expression

#36

There is also a cron parser library from Cloudflare which is used for their cron jobs: https://github.com/cloudflare/saffron

I knew it. Please see also the comment at https://news.ycombinator.com/item?id=41666886

... and this PR [1][2]

[1] https://github.com/tisonkun/cronexpr/pull/12

[2] https://docs.rs/cronexpr/latest/cronexpr/struct.Crontab.html...

Post reply on HN