RFR: 8285838: DST not applying properly with zone id offset set with TZ env variable [v6]

Naoto Sato naoto at openjdk.java.net
Thu Jun 2 18:33:31 UTC 2022


On Thu, 2 Jun 2022 18:14:55 GMT, Gaurav Chaudhari <duke at openjdk.java.net> wrote:

> Is the suggestion here to substitute the setting of the TZ environment variable, and simply getting a date based off this `SimpleTimeZone` , so as to bypass the process creation and just have it as a more simpler test?

No. The test process still has to be spawned with the TZ env variable set. The suggested piece is supposed to replace the following `if` in `runTZTest()` method:

        Calendar calendar = Calendar.getInstance();
        Date time = calendar.getTime();
        // Add 1 since getMonth() starts from 0.
        int month = time.getMonth() + 1;
        ZonedDateTime date = ZonedDateTime.ofInstant(time.toInstant(), ZoneId.systemDefault());
        if ((month > Month.MARCH.getValue() && month < Month.OCTOBER.getValue()) ||
                (month == Month.MARCH.getValue() && date.isAfter(getLastSundayOfMonth(date))) ||
                (month == Month.OCTOBER.getValue() && date.isBefore(getLastSundayOfMonth(date)))) {

-------------

PR: https://git.openjdk.java.net/jdk/pull/8661


More information about the core-libs-dev mailing list