floraison / fugit

time tools (cron, parsing, durations, ...) for Ruby, rufus-scheduler, and flor
MIT License
353 stars 29 forks source link

Allow for standard range notation #56

Closed wishdev closed 3 years ago

wishdev commented 3 years ago

The notation X/Y is normally viewed as X-(MAX)/Y. This patch employs that functionality.

For example

15/30 for minutes should fire at both 15 and 45 minutes past the hour.

jmettraux commented 3 years ago

@wishdev Hello, thanks for this patch.

I looked at man 5 crontab on my dev machine (OpenBSD) and on Linux, it doesn't specify anything. By "Standard", what do you mean?

Thanks in advance, it will help me documenting your patch.

wishdev commented 3 years ago

My apologies on the use of the word standard here - I apparently misspoke slightly.

The quartz scheduler [1] is a cron tool I've used in the past and while I knew it was different because it accepted seconds - I was unaware it also was different in using this notation.

So for crontab.5 it appears that, as an example, 15/30 for minutes, is an invalid notation. For quartz 15/30 works as the patch does.

Fugit, prior this patch, sort of sat in the middle and would interpret 15/30 as 15 minutes after the hour - so I guess the 2 options are to extend out, as the patch does, to allow this form of notation - or to revert it all the way back and make 15/30 invalid.

Sorry for my misunderstanding as to the lay of the land. I got directly stuck in the middle on this one

[1] - http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html

jmettraux commented 3 years ago

Hello, no worries. Thanks a ton for taking the time to answer.

I think I will release as 1.5.0 since it introduces a behaviour change.

Thanks again!