atifaziz / NCrontab

Crontab for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GetNextOccurrence doesn't return the correct next occurence

MaznasPetros opened this issue · comments

Here is an example of getting wrong values.

Expression: */30 * 23,0,1,2 * * 1-5
Running time: Thursday,14:40:25
GetNextOccurrence returns: Thurday, 23:00:30 (while this should be Thursday, 23:00:00)

In the previous example, I get the correct next occurence if the running time is different
Expression: */30 * 23,0,1,2 * * 1-5
Running time: Thursday,14:40:40
GetNextOccurrence returns: Thurday, 23:00:00 (correct!)

I dont have the same issue when setting up the expression like */30 * 23,0,1,2 * * 0,6 and running it through the weekdays (e.g. Thursday)
Expression: */30 * 23,0,1,2 * * 0,6
Running time: Thursday,14:40:40 OR Thursday,14:40:10
GetNextOccurrence returns: Saturday, 24:00:00 (correct!)

Basically, based on the current second tick it calculates the next occurence second while not respecting the hours or days before calculating the seconds.

Closing this as a duplicate of #90.

The bug has been fixed in PR #91 and slated for 3.3.3, but which hasn't been released yet.

The bug fix is now available in release 3.3.3.

Thanks for the quick response @atifaziz and thank you for the release ;)