TimeZone Issue - Quartz 1.8.6

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

TimeZone Issue - Quartz 1.8.6

cmoulliard
This post has NOT been accepted by the mailing list yet.
Hi,

I would like to report a bug/issue with Quart 1.8.6 (but I suspect that it is still there with 2.2.1 too). The next time calculated to run a job when the Timezone is setted is not correct as the Date calculated is always done using the System Date and not according to the Calendar. If by example you try to define a CronExpression using "IST" Timezone (Indian Summer Time), the calendar created is well populated with the TimeZone but next into the code the Date + 1s  use a new System Date and not a Date created according to the TimeZone :

public class CronExpression
     public Date getTimeAfter(Date afterTime) {

        // Computation is based on Gregorian year only.
        Calendar cl = new java.util.GregorianCalendar(getTimeZone()); // CORRECT

        // move ahead one second, since we're computing the time *after* the
        // given time
        afterTime = new Date(afterTime.getTime() + 1000); // USE SYSTEM MACHINE DATE to generate a new Date and not according to the TIMEZONE

Regards,

Charles