I am trying to build a repeating daily schedule in Quartz.Net but having a few issues:
First off, I build a daily schedule, repating at 12:45 Using Quartz.Net code like this:
var trigger = TriggerBuilder.Create()
.WithDailyTimeIntervalSchedule(s =>
s.OnEveryDay().StartingDailyAt(new TimeOfDay(13, 00)))
.Build();
var times = TriggerUtils.ComputeFireTimes(trigger as IOperableTrigger, null, 10);
foreach (var time in times) Console.WriteLine(time);
This is being executed in New Zealand, DST (so UTC+13:00)
And the output I get is rather strange:
5/10/2012 1:00:00 p.m. +13:00
5/10/2012 12:01:00 a.m. +00:00
5/10/2012 12:02:00 a.m. +00:00
5/10/2012 12:03:00 a.m. +00:00
5/10/2012 12:04:00 a.m. +00:00
5/10/2012 12:05:00 a.m. +00:00
5/10/2012 12:06:00 a.m. +00:00
5/10/2012 12:07:00 a.m. +00:00
5/10/2012 12:08:00 a.m. +00:00
5/10/2012 12:09:00 a.m. +00:00
The first date/time is displayed using local timezone, then the rest are displayed with UTC, and each time value is incremented by 1 minute, and the date never changes.
I feel like I might be missing something fundamental here with the daily time interval schedule, but I just don't know what it is?
Edit
As an update to do this, I have now switched to using a CRON expression based trigger:
TriggerBuilder.Create()
.WithCronSchedule(string.Format("0 {0} {1} ? * *", 0, 13))
.Build();
And it gave me the results I would expect:
5/10/2012 12:00:00 a.m. +00:00
6/10/2012 12:00:00 a.m. +00:00
7/10/2012 12:00:00 a.m. +00:00
8/10/2012 12:00:00 a.m. +00:00
9/10/2012 12:00:00 a.m. +00:00
10/10/2012 12:00:00 a.m. +00:00
11/10/2012 12:00:00 a.m. +00:00
12/10/2012 12:00:00 a.m. +00:00
13/10/2012 12:00:00 a.m. +00:00
14/10/2012 12:00:00 a.m. +00:00
But I would still like to know why the DailyTimeIntervale schedule is not working...
You aren't specifying the interval which happens to default to 1 minute, so it assumes you want to run the job every minute.
Try
ITrigger trigger = TriggerBuilder.Create()
.WithDailyTimeIntervalSchedule
(s =>
s.WithIntervalInHours(24)
.OnEveryDay()
.StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(13, 0))
)
.Build();
The default should be to run every day, so the OnEveryDay() isn't really needed.
Not sure why you are seeing local and UTC, as all my times are displayed in UTC.