On Thu, 2 Jun 2022 18:14:55 GMT, Gaurav Chaudhari <d...@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

Reply via email to