I’ve used Quartz.net for a little while – more specifically, around 6 months. I started working with it around the end of October 2009. Irrelevant, you may think, but the important thing here is the time. During winter months, the UK runs on GMT (or UTC+0)
During these months, (up until 28th March 2010) my application functioned as expected – however, when the clocks went forward for British Summer Time, the trigger stopped firing.
The problem?
I’d specified my triggers start time like this:
trigger.StartTimeUtc = DateTime.Now;
Which was fine, when, before the clocks go forward for summer.
After the clocks go forward (and we start enjoying lighter evenings etc…) the UK is on UTC+01 (British Summer Time)
This means, at the time of writing (circa 14:45pm, April 12th 2010) the values of DateTime.Now and DateTime.UtcNow are as follows:
DateTime.Now
12/04/2010 14:47:39
DateTime.UtcNow
12/04/2010 13:46:58
… a whole hour and a few seconds difference.
By using DateTime.Now to set the start time (which expects the time as UTC) – I was in fact, telling Quartz.net to start the trigger at 14:47 – an hour later than I wanted.
Summary
Always use DateTime.UtcNow to set the Triggers StartTimeUtc 🙂
Leave a Reply