capnspacehook / taskmaster

Windows Task Scheduler Library for Go
MIT License
142 stars 29 forks source link

Incorrect interpretation of intervals #22

Open BZValoche opened 3 years ago

BZValoche commented 3 years ago

DayInterval and WeekInterval are directly the number of days of weeks between task runs.

capnspacehook commented 3 years ago

Per MSDN, day intervals and week intervals can both be only 2 values:

https://docs.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-idailytrigger-get_daysinterval https://docs.microsoft.com/en-us/windows/win32/api/taskschd/nf-taskschd-iweeklytrigger-get_weeksinterval

I see what you're trying to do here, but to my knowledge Windows will not allow a day interval or week interval to have any other value then 1 or 2.

I'm going to leave this PR open for a bit in case there's something I'm missing, but regardless thanks for the PR!

BZValoche commented 3 years ago

Hi, Microsoft's documentation gives an example of how to schedule a task every other day. But if you want 3 days or weeks between successive runs, you surely can enter another value.

Look at this sample task (in french, but I'm sure you'll get it ;-) ): image

DaysInterval definition specifies the value must be between 1 and 365, inclusive. https://docs.microsoft.com/en-us/windows/win32/taskschd/taskschedulerschema-daysinterval-dailyscheduletype-element

WeeksInterval, between 1 and 52. https://docs.microsoft.com/en-us/windows/win32/taskschd/taskschedulerschema-weeksinterval-weeklyscheduletype-element