PATCH: PR 1411 Remove natTimeZone.cc (proposal)

Warren Levy warrenl@redhat.com
Wed Dec 27 23:44:00 GMT 2000


Folks,
Here is a patch I've come up with for removing natTimeZone.cc.  I'm not
completely happy with it as it is isn't as clean as I usually like things
to be.  Specifically, take a look at the patch to java/lang/natSystem.cc
and let me know if you have any ideas for improvement.

The issue is that we have to both recognize standard timezone names (per
the JCL) in case a user sets the user.timezone property, as well as
figuring out a valid timezone from the attributes of the timezone as
reported by the OS (e.g. GMT offset and whether daylight savings time
is used).  I suppose I could just set the property here without doing
any verification and then do all these checks for the name and zone
attributes in a private method in java.util.TimeZone.  This alternative
didn't seem as clean since some context is lost upon leaving the new
java.lang.System.getDefaultTimeZoneId (i.e. the zone name and GMT offset
are no longer available as separate entities and would have to be parsed
from the user.timezone property and distinguished from valid timezone
names in user.timezone that don't follow the PST8PDT format).  The nit
that really bugs me the most is that I've had to free up memory in a
separate block from where I allocated it (I usually like to keep them
together); otherwise, I feel pretty good about the patch.  It does take
care of the PR and supports timezones better than we've done to date.

For the record also note that I've reworked the algorithm that came from
Classpath for setting the timezone from the form e.g. "PST8PDT" to "PST"
per the standard usage in the JCL.  I've added the standard timezone names
to accommodate this.  This is a straightforward change and I don't see any
problems with it.

If I don't hear back from anyone with improvements or alternatives in a
day or two, I'll just go ahead and commit the patch (it can always be
adjusted later if someone comes up with something better down the road).

I don't have a new JNI version of getDefaultTimeZoneId to use for the
parallel Classpath patches.  If anyone has an itch to do that, let me
know.
--warrenl


2000-12-27  Warren Levy  <warrenl@redhat.com>

        Fix for PR libgcj/1411:
        * Makefile.am: Removed java/util/natTimeZone.cc.
        * Makefile.in: Rebuilt.
        * gnu/gcj/text/LocaleData_en_US.java (zoneStringsDefault): Added
        missing localized timezone names.
        * java/lang/natSystem.cc (getDefaultTimeZoneId): New private method.
        (init_properties): Set user.timezone property.
        * java/text/DateFormatSymbols.java (zoneStringsDefault): Added
        default timezone names.  Use standard ID names per JCL.
        * java/util/TimeZone.java: Add standard ID names per JCL.
        (getDefaultTimeZoneId): Removed.
        * java/util/natTimeZone.cc: Removed.




More information about the Java-patches mailing list