views:

55

answers:

2

Hi

I am using quartz in my project and have one cron job. The cron expression I give the trigger (CronTrigger) as the running parameter is alighnt with the pc's hardware clock. Any ideas how to tell the job to look at the software clock instead ?

For instance I have a Job running for a year , and the it runs exactly at 10pm, and someday we switch to summer time , I would like the cron job to be automatically updated.

Roman

+1  A: 

By "summer time" you mean a change to Daylight_saving_time?

That case will be handled automatically.

The only thing you need to be careful of is jobs scheduled during the actual shift itself.

In the forward shift the time goes from 1am (std) to 2am (std) to 1am (dst). Jobs scheduled to run between 1am and 2am need to make sure they do not run twice.

The shift back may have the reverse effect. The time goes from 1am (dst) to 2am (dst) to 3am (std). Depending on how Quartz has implemented it, it can either skip the jobs in the interval, or run all the jobs in the interval after the shift.

If it's a job that absolutely must run, schedule it outside the shift window (shift time +/- 1 hour).

Devon_C_Miller
A: 

Simple, always use UTC for system time (and time zone) on servers.

I'm serious, this deals with issues like Daylight Saving rules, helps to ensure a near* monotonic increase in time (i.e. time doesn't "jump" backwards, breaking many assumptions for time-dependent software), and for servers and/or users across time-zones (i.e. geographically distributed computers and/or users).

*) I'll ignore leap seconds for this situation.

Since this appears to an issue with the computer system, and OS related tools (i.e. cron), I don't think this question is suitable for StackOverflow.com please consider moving it to ServerFault.com

mctylr