HangfireIO / Cronos

A fully-featured .NET library for working with Cron expressions. Built with time zones in mind and intuitively handles daylight saving time transitions
MIT License
974 stars 114 forks source link

Weekly with Steps not working #34

Closed npappireddy closed 3 years ago

npappireddy commented 3 years ago

A Step is working with every date part place holder. But the Day of the week place holder not considering */5 (with n number of Steps ahead when an weekly interval is given)

WorldIsM commented 3 years ago

Same with hours /1

odinserj commented 3 years ago

A Step is working with every date part place holder. But the Day of the week place holder not considering */5 (with n number of Steps ahead when an weekly interval is given)

Unfortunately this problem relates to the format itself, please see this section on Wikipedia:

Note that frequencies in general cannot be expressed; only step values which evenly divide their range express accurate frequencies (for minutes and seconds, that's /2, /3, /4, /5, /6, /10, /12, /15, /20 and /30 because 60 is evenly divisible by those numbers; for hours, that's /2, /3, /4, /6, /8 and /12); all other possible "steps" and all other fields yield inconsistent "short" periods at the end of the time-unit before it "resets" to the next minute, second, or day; for example, entering `/5for the day field sometimes executes after1,2, or3` days, depending on the month and leap year; this is because cron is stateless (it does not remember the time of the last execution nor count the difference between it and now, required for accurate frequency counting—instead, cron is a mere pattern-matcher).*

Same with hours /1

6-part expressions in Cronos mean Second Minute Hour Day Month DayOfWeek, so */1 in this expression relates to minutes, not hours. And more over, the expression itself is the equivalent of "every minute".