re PR libgcj/1411 (natTimeZone.cc should be removed)
authorWarren Levy <warrenl@redhat.com>
Tue, 9 Jan 2001 07:07:51 +0000 (07:07 +0000)
committerWarren Levy <warrenl@gcc.gnu.org>
Tue, 9 Jan 2001 07:07:51 +0000 (07:07 +0000)
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/System.java (getDefaultTimeZoneId): New private method.
* java/lang/natSystem.cc (getSystemTimeZone): New private method.
(init_properties): Set user.timezone property.
* java/text/DateFormatSymbols.java (zoneStringsDefault): Added
default timezone names; removed non-standard ones.  Use standard
ID names per JCL.
* java/util/Date.java (toGMTString): Removed zoneGMT variable.
(UTC): Ditto.
* java/util/TimeZone.java: Add standard ID names per JCL; removed
non-standard ones.
(getDefaultTimeZoneId): Removed.
(zoneGMT): Removed.
(getDefaultTimeZoneId): Removed.
* java/util/natTimeZone.cc: Removed.

From-SVN: r38816

libjava/ChangeLog
libjava/Makefile.am
libjava/Makefile.in
libjava/gnu/gcj/text/LocaleData_en_US.java
libjava/java/lang/System.java
libjava/java/lang/natSystem.cc
libjava/java/text/DateFormatSymbols.java
libjava/java/util/Date.java
libjava/java/util/TimeZone.java
libjava/java/util/natTimeZone.cc [deleted file]

index 42421be56dab0992c7143ddcaba0c027640f2907..22d78261ad2286964d2251272041d3668e947236 100644 (file)
@@ -1,3 +1,25 @@
+2001-01-08  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/System.java (getDefaultTimeZoneId): New private method.
+       * java/lang/natSystem.cc (getSystemTimeZone): New private method.
+       (init_properties): Set user.timezone property.
+       * java/text/DateFormatSymbols.java (zoneStringsDefault): Added
+       default timezone names; removed non-standard ones.  Use standard
+       ID names per JCL.
+       * java/util/Date.java (toGMTString): Removed zoneGMT variable.
+       (UTC): Ditto.
+       * java/util/TimeZone.java: Add standard ID names per JCL; removed
+       non-standard ones.
+       (getDefaultTimeZoneId): Removed.
+       (zoneGMT): Removed.
+       (getDefaultTimeZoneId): Removed.
+       * java/util/natTimeZone.cc: Removed.
+
 2001-01-08  Bryce McKinlay  <bryce@albatross.co.nz>
 
        * java/lang/Class.h (_Jv_InitClass): Use __builtin_expect.
index ae83a20405f74b47df2f1c11383429eec0314886..53e3cabcc7f9440614587cce14032e474a5cb328 100644 (file)
@@ -1260,7 +1260,6 @@ java/net/natPlainDatagramSocketImpl.cc \
 java/net/natPlainSocketImpl.cc \
 java/text/natCollator.cc \
 java/util/natGregorianCalendar.cc \
-java/util/natTimeZone.cc \
 java/util/zip/natDeflater.cc \
 java/util/zip/natInflater.cc
 
index ada702e02f99345fc1bde38216b2990e993f043d..6dda807c2db560fcf55734cf3cab1efa1baf320c 100644 (file)
@@ -1020,7 +1020,6 @@ java/net/natPlainDatagramSocketImpl.cc \
 java/net/natPlainSocketImpl.cc \
 java/text/natCollator.cc \
 java/util/natGregorianCalendar.cc \
-java/util/natTimeZone.cc \
 java/util/zip/natDeflater.cc \
 java/util/zip/natInflater.cc
 
@@ -1172,8 +1171,8 @@ java/lang/reflect/natArray.lo java/lang/reflect/natConstructor.lo \
 java/lang/reflect/natField.lo java/lang/reflect/natMethod.lo \
 java/net/natInetAddress.lo java/net/natPlainDatagramSocketImpl.lo \
 java/net/natPlainSocketImpl.lo java/text/natCollator.lo \
-java/util/natGregorianCalendar.lo java/util/natTimeZone.lo \
-java/util/zip/natDeflater.lo java/util/zip/natInflater.lo
+java/util/natGregorianCalendar.lo java/util/zip/natDeflater.lo \
+java/util/zip/natInflater.lo
 libgcjx_la_OBJECTS =  gnu/gcj/xlib/natClip.lo \
 gnu/gcj/xlib/natColormap.lo gnu/gcj/xlib/natDisplay.lo \
 gnu/gcj/xlib/natDrawable.lo gnu/gcj/xlib/natFont.lo \
index 083a86157f6858889564cbc9ea2fc5e83910fe7a..eb5d4f14be164b87dcfbf826f9088794a783ced8 100644 (file)
@@ -21,6 +21,8 @@ public final class LocaleData_en_US extends ListResourceBundle
 {
   // These are for DateFormatSymbols.
   static String[][] zoneStringsDefault = {
+    { "GMT", "Greenwich Mean Time", "GMT",
+      /**/   "Greenwich Mean Time", "GMT", "GMT" },
     { "PST", "Pacific Standard Time", "PST",
       /**/   "Pacific Daylight Time", "PDT", "San Francisco" },
     { "MST", "Mountain Standard Time", "MST",
@@ -35,10 +37,18 @@ public final class LocaleData_en_US extends ListResourceBundle
       /**/   "Eastern Standard Time", "EST", "Indianapolis" },
     { "PRT", "Atlantic Standard Time", "AST",
       /**/   "Atlantic Daylight Time", "ADT", "Halifax" },
+    { "CNT", "Newfoundland Standard Time", "NST",
+      /**/   "Newfoundland Daylight Time", "NDT", "St. Johns" },
+    { "ECT", "Central European Standard Time", "CET",
+      /**/   "Central European Daylight Time", "CEST", "Paris" },
+    { "CTT", "China Standard Time", "CST",
+      /**/   "China Standard Time", "CST", "Shanghai" },
+    { "JST", "Japan Standard Time", "JST",
+      /**/   "Japan Standard Time", "JST", "Tokyo" },
     { "HST", "Hawaii Standard Time", "HST",
-      /**/   "Hawaii Daylight Time", "HDT", "Honolulu" },
-    { "AST", "Alaska Standard Time", "AST",
-      /**/   "Alaska Daylight Time", "ADT", "Anchorage" }
+      /**/   "Hawaii Standard Time", "HST", "Honolulu" },
+    { "AST", "Alaska Standard Time", "AKST",
+      /**/   "Alaska Daylight Time", "AKDT", "Anchorage" }
   };
 
   private static final Object[][] contents =
index ab1ca99d90bd057168458705e302bb7c6d447201..162bc1f21eb31fc56944f91e96a5001fbea2d7c9 100644 (file)
@@ -1,6 +1,6 @@
 // System.java - System-specific info.
 
-/* Copyright (C) 1998, 1999, 2000  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -20,6 +20,7 @@ import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.util.Properties;
 import java.util.PropertyPermission;
+import java.util.TimeZone;
 
 /**
  * @author Tom Tromey <tromey@cygnus.com>
@@ -41,6 +42,83 @@ public final class System
 
   public static native long currentTimeMillis ();
 
+  // FIXME: When merging with Classpath, remember to remove the call to
+  // getDefaultTimeZoneId from java.util.Timezone.
+  private static native String getSystemTimeZone ();
+
+  // Get the System Timezone as reported by the OS.  It should be in
+  // the form PST8PDT so we'll need to parse it and check that it's valid.
+  // The result is used to set the user.timezone property in init_properties.
+  // FIXME: Using the code from Classpath for generating the System
+  // Timezone IMO is suboptimal because it ignores whether the rules for
+  // DST match up.
+  private static String getDefaultTimeZoneId ()
+  {
+    String sysTimeZoneId = getSystemTimeZone ();
+
+    // Check if this is a valid timezone.  Make sure the IDs match
+    // since getTimeZone returns GMT if no match is found.
+    TimeZone tz = TimeZone.getTimeZone (sysTimeZoneId);
+    if (tz.getID ().equals (sysTimeZoneId))
+      return sysTimeZoneId;
+
+    // Check if the base part of sysTimeZoneId is a valid timezone that
+    // matches with daylight usage and rawOffset.  Make sure the IDs match
+    // since getTimeZone returns GMT if no match is found.
+    // First find start of GMT offset info and any Daylight zone name.
+    int startGMToffset = 0;
+    int sysTimeZoneIdLength = sysTimeZoneId.length();
+    for (int i = 0; i < sysTimeZoneIdLength && startGMToffset == 0; i++)
+      {
+        if (Character.isDigit (sysTimeZoneId.charAt (i)))
+         startGMToffset = i;
+      }
+
+    int startDaylightZoneName = 0;
+    boolean usesDaylight = false;
+    for (int i = sysTimeZoneIdLength - 1;
+         i >= 0 && !Character.isDigit (sysTimeZoneId.charAt (i)); --i)
+      {
+        startDaylightZoneName = i;
+      }
+    if (startDaylightZoneName > 0)
+      usesDaylight = true;
+
+    int GMToffset = Integer.parseInt (startDaylightZoneName == 0 ?
+      sysTimeZoneId.substring (startGMToffset) :
+      sysTimeZoneId.substring (startGMToffset, startDaylightZoneName));
+
+    // Offset could be in hours or seconds.  Convert to millis.
+    if (GMToffset < 24)
+      GMToffset *= 60 * 60;
+    GMToffset *= -1000;
+
+    String tzBasename = sysTimeZoneId.substring (0, startGMToffset);
+    tz = TimeZone.getTimeZone (tzBasename);
+    if (tz.getID ().equals (tzBasename) && tz.getRawOffset () == GMToffset)
+      {
+        boolean tzUsesDaylight = tz.useDaylightTime ();
+        if (usesDaylight && tzUsesDaylight || !usesDaylight && !tzUsesDaylight)
+          return tzBasename;
+      }
+  
+    // If no match, see if a valid timezone has the same attributes as this
+    // and then use it instead.
+    String[] IDs = TimeZone.getAvailableIDs (GMToffset);
+    for (int i = 0; i < IDs.length; ++i)
+      {
+       // FIXME: The daylight savings rules may not match the rules
+       // for the desired zone.
+        boolean IDusesDaylight =
+         TimeZone.getTimeZone (IDs[i]).useDaylightTime ();
+        if (usesDaylight && IDusesDaylight || !usesDaylight && !IDusesDaylight)
+         return IDs[i];
+      }
+
+    // If all else fails, return null.
+    return null;
+  }
+
   public static void exit (int status)
   {
     Runtime.getRuntime().exit(status);
index a987e8d5ef04c60ff5129c7aff6f9828129e72c7..2fccf92f118c10e9615d92dfef7c7a85e9963357 100644 (file)
@@ -1,6 +1,6 @@
 // natSystem.cc - Native code implementing System class.
 
-/* Copyright (C) 1998, 1999, 2000  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -10,6 +10,7 @@ details.  */
 
 #include <config.h>
 
+#include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 
@@ -28,6 +29,17 @@ details.  */
 #include <langinfo.h>
 #endif
 
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
 #include <gcj/cni.h>
 #include <jvm.h>
 #include <java-props.h>
@@ -38,6 +50,7 @@ details.  */
 #include <java/lang/NullPointerException.h>
 #include <java/lang/StringBuffer.h>
 #include <java/util/Properties.h>
+#include <java/util/TimeZone.h>
 #include <java/io/PrintStream.h>
 #include <java/io/InputStream.h>
 
@@ -214,6 +227,50 @@ getpwuid_adaptor(T_passwd * (*getpwuid_r)(T_uid user_id, T_passwd *pwd_r,
 }
 #endif
 
+/*
+ * This method returns a time zone string that is used by init_properties
+ * to set the default timezone property 'user.timezone'.  That value is
+ * used by default as a key into the timezone table used by the
+ * java::util::TimeZone class.
+ */
+jstring
+java::lang::System::getSystemTimeZone (void)
+{
+  time_t current_time;
+  char **tzinfo, *tzid;
+  long tzoffset;
+
+  current_time = time(0);
+
+  mktime(localtime(&current_time));
+  tzinfo = tzname;
+  tzoffset = timezone;
+
+  if ((tzoffset % 3600) == 0)
+    tzoffset = tzoffset / 3600;
+
+  if (!strcmp(tzinfo[0], tzinfo[1]))  
+    {
+      tzid = (char*) _Jv_Malloc (strlen(tzinfo[0]) + 6);
+      if (!tzid)
+        return NULL;
+
+      sprintf(tzid, "%s%ld", tzinfo[0], tzoffset);
+    }
+  else
+    {
+      tzid = (char*) _Jv_Malloc (strlen(tzinfo[0]) + strlen(tzinfo[1]) + 6);
+      if (!tzid)
+        return NULL;
+
+      sprintf(tzid, "%s%ld%s", tzinfo[0], tzoffset, tzinfo[1]);
+    }
+
+  jstring retval = JvNewStringUTF (tzid);
+  _Jv_Free (tzid);
+  return retval;
+}
+
 void
 java::lang::System::init_properties (void)
 {
@@ -364,6 +421,11 @@ java::lang::System::init_properties (void)
       SET ("user.language", "en");
     }  
 
+  // Set the "user.timezone" property.
+  jstring timezone = getDefaultTimeZoneId ();
+  if (timezone != NULL)
+    newprops->put (JvNewStringLatin1 ("user.timezone"), timezone);
+
   // Set some properties according to whatever was compiled in with
   // `-D'.
   for (int i = 0; _Jv_Compiler_Properties[i]; ++i)
index efe1d891e0dc7be0925b3e3d71a05d5ff6f76835..252f9fa7743c8724afefcf0ddce99d6524f5ce26 100644 (file)
@@ -81,24 +81,18 @@ public class DateFormatSymbols extends Object
       /**/   "Eastern Standard Time", "EST", "Indianapolis" },
     { "PRT", "Atlantic Standard Time", "AST",
       /**/   "Atlantic Daylight Time", "ADT", "Halifax" },
+    { "CNT", "Newfoundland Standard Time", "NST",
+      /**/   "Newfoundland Daylight Time", "NDT", "St. Johns" },
+    { "ECT", "Central European Standard Time", "CET",
+      /**/   "Central European Daylight Time", "CEST", "Paris" },
+    { "CTT", "China Standard Time", "CST",
+      /**/   "China Standard Time", "CST", "Shanghai" },
+    { "JST", "Japan Standard Time", "JST",
+      /**/   "Japan Standard Time", "JST", "Tokyo" },
     { "HST", "Hawaii Standard Time", "HST",
-      /**/   "Hawaii Daylight Time", "HDT", "Honolulu" },
-    { "AST", "Alaska Standard Time", "AST",
-      /**/   "Alaska Daylight Time", "ADT", "Anchorage" },
-    { "PST8PDT", "Pacific Standard Time", "PST",
-      /******/   "Pacific Daylight Time", "PDT", "San Francisco" },
-    { "MST7MDT", "Mountain Standard Time", "MST",
-      /******/   "Mountain Daylight Time", "MDT", "Denver" },
-    { "CST6CDT", "Central Standard Time", "CST",
-      /******/   "Central Daylight Time", "CDT", "Chicago" },
-    { "EST5EDT", "Eastern Standard Time", "EST",
-      /******/   "Eastern Daylight Time", "EDT", "Boston" },
-    { "AST4ADT", "Atlantic Standard Time", "AST",
-      /******/   "Atlantic Daylight Time", "ADT", "Halifax" },
-    { "HST10HDT", "Hawaii Standard Time", "HST",
-      /*******/   "Hawaii Daylight Time", "HDT", "Honolulu" },
-    { "AST9ADT", "Alaska Standard Time", "AKST",
-      /******/   "Alaska Daylight Time", "AKDT", "Anchorage" }
+      /**/   "Hawaii Standard Time", "HST", "Honolulu" },
+    { "AST", "Alaska Standard Time", "AKST",
+      /**/   "Alaska Daylight Time", "AKDT", "Anchorage" }
   };
 
   // These are each arrays with a value for SHORT, MEDIUM, LONG, FULL,
index 4b76b8ab6eff09f5facc991a921e4b7eccdcb621..d3301be3613d1a2ba9f227b176f1fe038314eaef 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -461,7 +461,7 @@ public class Date implements java.io.Serializable, Cloneable
     // This method is deprecated.  We don't care if it is very slow.
     SimpleDateFormat fmt = new SimpleDateFormat ("d MMM yyyy HH:mm:ss 'GMT'",
                                                 Locale.US);
-    fmt.setTimeZone(TimeZone.zoneGMT);
+    fmt.setTimeZone(TimeZone.getTimeZone("GMT"));
     return fmt.format(this);
   }
 
@@ -476,7 +476,7 @@ public class Date implements java.io.Serializable, Cloneable
   public static long UTC (int year, int month, int date,
                          int hours, int minutes, int seconds)
   {
-    GregorianCalendar cal = new GregorianCalendar (TimeZone.zoneGMT);
+    GregorianCalendar cal = new GregorianCalendar (TimeZone.getTimeZone("GMT"));
     cal.set(year+1900, month, date, hours, minutes, seconds);
     return cal.getTimeInMillis();
   }
index 0b9ea06bcea9b0d8482981bb3bc0d714d0530eab..e68f9b56a80c318bf1ba9475ff2f3eed5a19cf0d 100644 (file)
@@ -1,5 +1,5 @@
 /* java.util.TimeZone
-   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -82,7 +82,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
     TimeZone tz;
     // Automatically generated by scripts/timezones.pl
     // XXX - Should we read this data from a file?
-    tz = new SimpleTimeZone(-11000 * 3600, "Pacific/Niue");
+    tz = new SimpleTimeZone(-11000 * 3600, "MIT");
+    timezones.put("MIT", tz);
     timezones.put("Pacific/Niue", tz);
     timezones.put("Pacific/Apia", tz);
     timezones.put("Pacific/Midway", tz);
@@ -100,9 +101,10 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
     timezones.put("Pacific/Rarotonga", tz);
     timezones.put("Pacific/Tahiti", tz);
     tz = new SimpleTimeZone
-      (-9000 * 3600, "America/Juneau",
+      (-9000 * 3600, "AST",
        Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+    timezones.put("AST", tz);
     timezones.put("America/Juneau", tz);
     timezones.put("America/Anchorage", tz);
     timezones.put("America/Nome", tz);
@@ -112,10 +114,10 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
     tz = new SimpleTimeZone(-8500 * 3600, "Pacific/Marquesas");
     timezones.put("Pacific/Marquesas", tz);
     tz = new SimpleTimeZone
-      (-8000 * 3600, "PST8PDT",
+      (-8000 * 3600, "PST",
        Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
-    timezones.put("PST8PDT", tz);
+    timezones.put("PST", tz);
     timezones.put("America/Dawson", tz);
     timezones.put("America/Los_Angeles", tz);
     timezones.put("America/Tijuana", tz);
@@ -124,15 +126,15 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
     timezones.put("US/Pacific-New", tz);
     tz = new SimpleTimeZone(-8000 * 3600, "Pacific/Pitcairn");
     timezones.put("Pacific/Pitcairn", tz);
-    tz = new SimpleTimeZone(-7000 * 3600, "MST");
-    timezones.put("MST", tz);
+    tz = new SimpleTimeZone(-7000 * 3600, "PNT");
+    timezones.put("PNT", tz);
     timezones.put("America/Dawson_Creek", tz);
     timezones.put("America/Phoenix", tz);
     tz = new SimpleTimeZone
-      (-7000 * 3600, "MST7MDT",
+      (-7000 * 3600, "MST",
        Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
-    timezones.put("MST7MDT", tz);
+    timezones.put("MST", tz);
     timezones.put("America/Boise", tz);
     timezones.put("America/Chihuahua", tz);
     timezones.put("America/Denver", tz);
@@ -152,10 +154,10 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
     timezones.put("America/Tegucigalpa", tz);
     timezones.put("Pacific/Galapagos", tz);
     tz = new SimpleTimeZone
-      (-6000 * 3600, "CST6CDT",
+      (-6000 * 3600, "CST",
        Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
-    timezones.put("CST6CDT", tz);
+    timezones.put("CST", tz);
     timezones.put("America/Cambridge_Bay", tz);
     timezones.put("America/Cancun", tz);
     timezones.put("America/Chicago", tz);
@@ -181,8 +183,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.APRIL, 1, 0, 0 * 3600,
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
     timezones.put("America/Havana", tz);
-    tz = new SimpleTimeZone(-5000 * 3600, "EST");
-    timezones.put("EST", tz);
+    tz = new SimpleTimeZone(-5000 * 3600, "IET");
+    timezones.put("IET", tz);
     timezones.put("America/Bogota", tz);
     timezones.put("America/Cayman", tz);
     timezones.put("America/Guayaquil", tz);
@@ -197,10 +199,10 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
     timezones.put("America/Port-au-Prince", tz);
     timezones.put("America/Porto_Acre", tz);
     tz = new SimpleTimeZone
-      (-5000 * 3600, "EST5EDT",
+      (-5000 * 3600, "EST",
        Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
-    timezones.put("EST5EDT", tz);
+    timezones.put("EST", tz);
     timezones.put("America/Detroit", tz);
     timezones.put("America/Louisville", tz);
     timezones.put("America/Montreal", tz);
@@ -208,7 +210,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
     timezones.put("America/New_York", tz);
     timezones.put("America/Nipigon", tz);
     timezones.put("America/Thunder_Bay", tz);
-    tz = new SimpleTimeZone(-4000 * 3600, "America/Anguilla");
+    tz = new SimpleTimeZone(-4000 * 3600, "PRT");
+    timezones.put("PRT", tz);
     timezones.put("America/Anguilla", tz);
     timezones.put("America/Antigua", tz);
     timezones.put("America/Aruba", tz);
@@ -259,7 +262,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.SEPTEMBER, 2, Calendar.SUNDAY, 0 * 3600,
        Calendar.APRIL, 16, -Calendar.SUNDAY, 0 * 3600);
     timezones.put("Atlantic/Stanley", tz);
-    tz = new SimpleTimeZone(-3000 * 3600, "America/Buenos_Aires");
+    tz = new SimpleTimeZone(-3000 * 3600, "AGT");
+    timezones.put("AGT", tz);
     timezones.put("America/Buenos_Aires", tz);
     timezones.put("America/Belem", tz);
     timezones.put("America/Catamarca", tz);
@@ -289,9 +293,10 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
     timezones.put("America/Miquelon", tz);
     tz = new SimpleTimeZone
-      (-2500 * 3600, "America/St_Johns",
+      (-3500 * 3600, "CNT",
        Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+    timezones.put("CNT", tz);
     timezones.put("America/St_Johns", tz);
     tz = new SimpleTimeZone(-2000 * 3600, "America/Noronha");
     timezones.put("America/Noronha", tz);
@@ -362,6 +367,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
     timezones.put("CET", tz);
+    timezones.put("ECT", tz);
     timezones.put("Africa/Ceuta", tz);
     timezones.put("Arctic/Longyearbyen", tz);
     timezones.put("Europe/Amsterdam", tz);
@@ -399,7 +405,9 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.APRIL, -1, Calendar.FRIDAY, 0 * 3600,
        Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 23000 * 3600);
     timezones.put("Africa/Cairo", tz);
-    tz = new SimpleTimeZone(2000 * 3600, "Africa/Gaborone");
+    timezones.put("ART", tz);
+    tz = new SimpleTimeZone(2000 * 3600, "CAT");
+    timezones.put("CAT", tz);
     timezones.put("Africa/Gaborone", tz);
     timezones.put("Africa/Blantyre", tz);
     timezones.put("Africa/Bujumbura", tz);
@@ -470,7 +478,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
     timezones.put("Europe/Tiraspol", tz);
     timezones.put("Europe/Moscow", tz);
-    tz = new SimpleTimeZone(3000 * 3600, "Indian/Comoro");
+    tz = new SimpleTimeZone(3000 * 3600, "EAT");
+    timezones.put("EAT", tz);
     timezones.put("Indian/Comoro", tz);
     timezones.put("Africa/Addis_Ababa", tz);
     timezones.put("Africa/Asmera", tz);
@@ -506,7 +515,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
     timezones.put("Asia/Yerevan", tz);
     timezones.put("Europe/Samara", tz);
-    tz = new SimpleTimeZone(4000 * 3600, "Indian/Mauritius");
+    tz = new SimpleTimeZone(4000 * 3600, "NET");
+    timezones.put("NET", tz);
     timezones.put("Indian/Mauritius", tz);
     timezones.put("Asia/Dubai", tz);
     timezones.put("Asia/Muscat", tz);
@@ -529,7 +539,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
     timezones.put("Asia/Yekaterinburg", tz);
-    tz = new SimpleTimeZone(5000 * 3600, "Indian/Kerguelen");
+    tz = new SimpleTimeZone(5000 * 3600, "PLT");
+    timezones.put("PLT", tz);
     timezones.put("Indian/Kerguelen", tz);
     timezones.put("Asia/Ashkhabad", tz);
     timezones.put("Asia/Dushanbe", tz);
@@ -538,11 +549,13 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
     timezones.put("Asia/Tashkent", tz);
     timezones.put("Indian/Chagos", tz);
     timezones.put("Indian/Maldives", tz);
-    tz = new SimpleTimeZone(5500 * 3600, "Asia/Calcutta");
+    tz = new SimpleTimeZone(5500 * 3600, "IST");
+    timezones.put("IST", tz);
     timezones.put("Asia/Calcutta", tz);
     tz = new SimpleTimeZone(5750 * 3600, "Asia/Katmandu");
     timezones.put("Asia/Katmandu", tz);
-    tz = new SimpleTimeZone(6000 * 3600, "Antarctica/Mawson");
+    tz = new SimpleTimeZone(6000 * 3600, "BST");
+    timezones.put("BST", tz);
     timezones.put("Antarctica/Mawson", tz);
     timezones.put("Asia/Colombo", tz);
     timezones.put("Asia/Dacca", tz);
@@ -561,7 +574,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
     tz = new SimpleTimeZone(6500 * 3600, "Asia/Rangoon");
     timezones.put("Asia/Rangoon", tz);
     timezones.put("Indian/Cocos", tz);
-    tz = new SimpleTimeZone(7000 * 3600, "Antarctica/Davis");
+    tz = new SimpleTimeZone(7000 * 3600, "VST");
+    timezones.put("VST", tz);
     timezones.put("Antarctica/Davis", tz);
     timezones.put("Asia/Bangkok", tz);
     timezones.put("Asia/Jakarta", tz);
@@ -574,7 +588,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
     timezones.put("Asia/Krasnoyarsk", tz);
-    tz = new SimpleTimeZone(8000 * 3600, "Antarctica/Casey");
+    tz = new SimpleTimeZone(8000 * 3600, "CTT");
+    timezones.put("CTT", tz);
     timezones.put("Antarctica/Casey", tz);
     timezones.put("Asia/Brunei", tz);
     timezones.put("Asia/Chungking", tz);
@@ -602,7 +617,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
        Calendar.SEPTEMBER, -1, Calendar.SUNDAY, 0 * 3600);
     timezones.put("Asia/Ulan_Bator", tz);
-    tz = new SimpleTimeZone(9000 * 3600, "Asia/Jayapura");
+    tz = new SimpleTimeZone(9000 * 3600, "JST");
+    timezones.put("JST", tz);
     timezones.put("Asia/Jayapura", tz);
     timezones.put("Asia/Pyongyang", tz);
     timezones.put("Asia/Seoul", tz);
@@ -619,7 +635,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600);
     timezones.put("Australia/Adelaide", tz);
     timezones.put("Australia/Broken_Hill", tz);
-    tz = new SimpleTimeZone(9500 * 3600, "Australia/Darwin");
+    tz = new SimpleTimeZone(9500 * 3600, "ACT");
+    timezones.put("ACT", tz);
     timezones.put("Australia/Darwin", tz);
     tz = new SimpleTimeZone(10000 * 3600, "Antarctica/DumontDUrville");
     timezones.put("Antarctica/DumontDUrville", tz);
@@ -646,6 +663,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600);
     timezones.put("Australia/Melbourne", tz);
     timezones.put("Australia/Sydney", tz);
+    timezones.put("AET", tz);
     tz = new SimpleTimeZone
       (10500 * 3600, "Australia/Lord_Howe",
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
@@ -656,7 +674,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
        Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
     timezones.put("Asia/Magadan", tz);
-    tz = new SimpleTimeZone(11000 * 3600, "Pacific/Ponape");
+    tz = new SimpleTimeZone(11000 * 3600, "SST");
+    timezones.put("SST", tz);
     timezones.put("Pacific/Ponape", tz);
     timezones.put("Pacific/Efate", tz);
     timezones.put("Pacific/Guadalcanal", tz);
@@ -671,6 +690,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
     timezones.put("Antarctica/McMurdo", tz);
     timezones.put("Antarctica/South_Pole", tz);
     timezones.put("Pacific/Auckland", tz);
+    timezones.put("NST", tz);
     tz = new SimpleTimeZone
       (12000 * 3600, "Asia/Kamchatka",
        Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
@@ -714,26 +734,12 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
 
     String tzid = System.getProperty("user.timezone");
 
-    if (tzid == null)
-      tzid = getDefaultTimeZoneId();
-
     if (tzid == null)
       tzid = "GMT";
 
     defaultZone = getTimeZone(tzid);
   }
 
-  /* This method returns us a time zone id string which is in the
-     form <standard zone name><GMT offset><daylight time zone name>.
-     The GMT offset is in seconds, except where it is evenly divisible
-     by 3600, then it is in hours.  If the zone does not observe
-     daylight time, then the daylight zone name is omitted.  Examples:
-     in Chicago, the timezone would be CST6CDT.  In Indianapolis 
-     (which does not have Daylight Savings Time) the string would
-     be EST5
-   */
-  private static native String getDefaultTimeZoneId();
-
   /**
    * Gets the time zone offset, for current date, modified in case of 
    * daylight savings.  This is the offset to add to UTC to get the local
@@ -1087,6 +1093,4 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
        return null;
       }
   }
-
-  static final TimeZone zoneGMT = new SimpleTimeZone(0, "GMT");
 }
diff --git a/libjava/java/util/natTimeZone.cc b/libjava/java/util/natTimeZone.cc
deleted file mode 100644 (file)
index 61128c8..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (C) 2000  Free Software Foundation
-
-   This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
-details.  */
-
-#include <config.h>
-
-#include <gcj/cni.h>
-#include <java/util/TimeZone.h>
-
-#include <stdio.h>
-#include <string.h>
-
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
-/*
- * This method returns a time zone string that is used by the static
- * initializer in java.util.TimeZone to create the default timezone
- * instance.  This is a key into the timezone table used by
- * that class.
- */
-jstring
-java::util::TimeZone::getDefaultTimeZoneId (void)
-{
-  time_t current_time;
-  char **tzinfo, *tzid;
-  long tzoffset;
-  jstring retval;
-
-  current_time = time(0);
-
-  mktime(localtime(&current_time));
-  tzinfo = tzname;
-  tzoffset = timezone;
-
-  if ((tzoffset % 3600) == 0)
-    tzoffset = tzoffset / 3600;
-
-  if (!strcmp(tzinfo[0], tzinfo[1]))  
-    {
-      tzid = (char*) _Jv_Malloc (strlen(tzinfo[0]) + 6);
-      if (!tzid)
-        return NULL;
-
-      sprintf(tzid, "%s%ld", tzinfo[0], tzoffset);
-    }
-  else
-    {
-      tzid = (char*) _Jv_Malloc (strlen(tzinfo[0]) + strlen(tzinfo[1]) + 6);
-      if (!tzid)
-        return NULL;
-
-      sprintf(tzid, "%s%ld%s", tzinfo[0], tzoffset, tzinfo[1]);
-    }
-
-  retval = JvNewStringUTF (tzid);
-  _Jv_Free (tzid);
-  return retval;
-}
-