Italy, as many other countries around the world, uses Daylight Saving Time (DST) during the summer: your software is ready for the transitions between normal time and summer time? Mine is it… now.

The trouble arises when you have a job that runs every N minutes, for example with a configuration (quartz_data.xml) with this kind of cron trigger:


<trigger>
<cron>
<name>MyTrigger</name>
<group>MyGroup</group>
<job-name>MyJob</job-name>
<job-group>MyGroup</job-group>
<cron-expression>10 1/3 * * * ?</cron-expression>
</cron>
</trigger>

When the DST ends, the series of the minutes is:

01:59:00+02 02:00:00+02 … 02:59:00+02 02:00:00+01 … 02:59:00+01 03:00:00+01

The previous trigger doesn’t fire for one hour, from 02:00:00+02 to 02:59:00+02.

The solution is to add a time zone:


<trigger>
<cron>
<name>MyTrigger</name>
<group>MyGroup</group>
<job-name>MyJob</job-name>
<job-group>MyGroup</job-group>
<cron-expression>10 1/3 * * * ?</cron-expression>
<time-zone>GMT</time-zone>
</cron>
</trigger>

Annunci