[kaffe] DateFormatTest regression

Ito Kazumitsu ito.kazumitsu at hitachi-cable.co.jp
Wed Mar 3 17:13:02 PST 2004

In message "Re: [kaffe] DateFormatTest regression"
    on 04/03/03, Guilhem Lavaux <guilhem at kaffe.org> writes:

> After some experiment, I'm principally suspecting SimpleTimeZone for 
> this. The bug also occurs with WET but not with some other really 
> similar timezones (like America/Scoresbysund)... Maybe tomorrow...

java/text/SimpleDateFormat.java reads

        if (! saw_timezone)
            // Use the real rules to determine whether or not this
            // particular time is in daylight savings.
            calendar.clear (Calendar.DST_OFFSET);
            calendar.clear (Calendar.ZONE_OFFSET);

I think this part is most suspicious.  I call this bug DST_BUG afterwards.

As for WET, java/util/TimeZone.java reads

        tz = new SimpleTimeZone
          (0 * 3600, "WET",
           Calendar.MARCH, -1, Calendar.SUNDAY, 1000 * 3600,
           Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);

This means WET's daylight saving time should start on the last
Sunday in March.  But now that DST_BUG occurs before the last
Sundy, there may be another bug about the handling of
DAY_OF_WEEK_IN_MONTH.  I call this this bug DOWIM_BUG afterwards.

As for America/Scoresbysund,  results vary depending on whether
you give the timezone by TZ or by user.timezone:

$ TZ=/usr/share/zoneinfo/America/Scoresbysund java DateFormat
Same time zone
Different time zone
$ java -Duser.timezone=Atlantic/Canary DateFormatTest
Same time zone
Dates don't match? Thu Mar 04 00:49:58 GMT+00:00 2004 != Thu Mar 04 01:49:58 GMT+00:00 2004
Different time zone

When you give the timezone by TZ, the zoneinfo from OS, which is
free from DOWIM_BUG and says DST starts on the last Sunday in March,
is used and DST_BUG does not occur until the last Sunday in March.

When you give the timezone by user.timezone,  DOWIM_BUG works and
the same thing occurs as WET.

By the way,

  I feel happy living in an area where they do not have daylight
  saving time although they have difficulty with CJK characters.

More information about the kaffe mailing list