Quartz.net trigger not firing

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 🙂

3 responses to “Quartz.net trigger not firing”

  1. […] One project in particular is a Windows Service, that sends out purchase orders on a schedule. (I recently wrote about how this broke due to Quartz.net expecting a UTC start time) […]

  2. Chris avatar
    Chris

    Alex, did you have any similar issues with latest version of quartz.net 2.1.2?

    1. Alex Brown avatar

      I’ve not had chance to try the new version

Leave a Reply

Your email address will not be published. Required fields are marked *