Blame SOURCES/gcc32-java-zoneinfo.patch

6f1b0c
2007-02-24  Jakub Jelinek  <jakub@redhat.com>
6f1b0c
6f1b0c
	* java/util/TimeZone.java (getDefaultDisplayName): Don't
6f1b0c
	check if TimeZone is instanceof SimpleTimeZone.
6f1b0c
6f1b0c
2007-02-23  Jakub Jelinek  <jakub@redhat.com>
6f1b0c
6f1b0c
	PR libgcj/17002
6f1b0c
	PR classpath/28550
6f1b0c
	* java/lang/System.java: Add gnu.java.util.zoneinfo.dir to comments.
6f1b0c
	* posix.cc (_Jv_platform_initProperties): Set
6f1b0c
	gnu.java.util.zoneinfo.dir.
6f1b0c
	* Makefile.am (ordinary_java_source_files): Add
6f1b0c
	gnu/java/util/ZoneInfo.java.
6f1b0c
	* Makefile.in: Regenerated.
6f1b0c
	* java/util/Date.java (parse): Properly parse 09:01:02 as
6f1b0c
	hours/minutes/seconds, not as hours/minutes/year.
6f1b0c
	* java/util/SimpleTimeZone.java (getOffset): Handle properly
6f1b0c
	millis + dstOffset overflowing into the next day.
6f1b0c
	* java/util/TimeZone.java (zoneinfo_dir, availableIDs, aliases0): New
6f1b0c
	static fields.
6f1b0c
	(timezones): Remove synchronized keyword.  Set zoneinfo_dir.
6f1b0c
	If non-null, set up aliases0 and don't put anything into
6f1b0c
	timezones0.
6f1b0c
	(defaultZone): Call getTZEnvVar to try TZ env var.
6f1b0c
	Try to read /etc/localtime using ZoneInfo.readTZFile.
6f1b0c
	Call getDefaultTimeZone instead of getTimeZone.
6f1b0c
	(getDefaultTimeZone, getDateParams, parseTime): New private methods.
6f1b0c
	(getTimeZoneInternal): New private method.
6f1b0c
	(getTimeZone): Do the custom ID checking first, canonicalize
6f1b0c
	ID for custom IDs as required by documentation.  Call
6f1b0c
	getTimeZoneInternal to handle the rest.
6f1b0c
	(getAvailableIDs(int)): Add locking.  Handle zoneinfo_dir != null.
6f1b0c
	(getAvailableIDs(File,String,ArrayList)): New private method.
6f1b0c
	(getAvailableIDs()): Add locking.  Handle zoneinfo_dir != null.
6f1b0c
	(readSysconfigClockFile): New static method.
6f1b0c
	(getTZEnvVar): New native method.
6f1b0c
	* java/util/natSystem.cc: Include java/lang/Character.h and
6f1b0c
	java/lang/Integer.h.
6f1b0c
	(java::lang::System::getSystemTimeZone): Renamed to...
6f1b0c
	(getSystemTimeZone): ... this.  Add static.
6f1b0c
	(java::lang::System::init_properties): Don't set user.timezone
6f1b0c
	property.
6f1b0c
	(java::util::TimeZone::getDefaultTimeZoneId): New.
6f1b0c
	(java::util::TimeZone::getTZEnvVar): New method.
6f1b0c
	* gnu/java/util/ZoneInfo.java: New file.
6f1b0c
	* java/util/GregorianCalendar.java
6f1b0c
	(GregorianCalendar): Call clear before set in the constructors that
6f1b0c
	don't initialize it to current time.
6f1b0c
6f1b0c
2007-02-09  Jakub Jelinek  <jakub@redhat.com>
6f1b0c
6f1b0c
	PR 23566
6f1b0c
	* java/util/TimeZone.java (timezones): Regenerate from tzdata2007a.
6f1b0c
6f1b0c
2005-02-21  Jeroen Frijters  <jeroen@frijters.net>
6f1b0c
6f1b0c
	* java/util/GregorianCalendar.java
6f1b0c
	(GregorianCalendar): Chained constructors to a (new)
6f1b0c
	common constructor.
6f1b0c
6f1b0c
2004-01-03  Per Bothner  <per@bothner.com>
6f1b0c
6f1b0c
	* java/util/Date.java (parse):  Fix a number of problems.
6f1b0c
	(skipParens):  Remove no-longer-needed method.
6f1b0c
6f1b0c
2003-11-27  Ito Kazumitsu  <kaz@maczuka.gcd.org>
6f1b0c
6f1b0c
	* java/util/GregorianCalendar.java (getLinearTime): Avoid counting
6f1b0c
	the leap day of the leap year twice.
6f1b0c
6f1b0c
2003-09-18  Ingo Proetel  <proetel@aicas.com>
6f1b0c
6f1b0c
	* java/util/TimeZone.java: Initialize lazily.
6f1b0c
6f1b0c
2002-05-13  Tom Tromey  <tromey@redhat.com>
6f1b0c
6f1b0c
	* java/util/TimeZone.java (getDefaultTimeZoneId): New method.
6f1b0c
6f1b0c
--- libjava/Makefile.am.jj	2007-02-23 21:17:39.000000000 +0100
6f1b0c
+++ libjava/Makefile.am	2007-02-23 21:28:22.000000000 +0100
6f1b0c
@@ -1431,6 +1431,7 @@ gnu/java/text/LineBreakIterator.java \
6f1b0c
 gnu/java/text/SentenceBreakIterator.java	\
6f1b0c
 gnu/java/text/WordBreakIterator.java \
6f1b0c
 gnu/java/util/DoubleEnumeration.java \
6f1b0c
+gnu/java/util/ZoneInfo.java \
6f1b0c
 java/lang/ref/PhantomReference.java \
6f1b0c
 java/lang/ref/Reference.java \
6f1b0c
 java/lang/ref/ReferenceQueue.java \
6f1b0c
--- libjava/Makefile.in.jj	2007-02-23 21:17:39.000000000 +0100
6f1b0c
+++ libjava/Makefile.in	2007-02-23 21:28:55.000000000 +0100
6f1b0c
@@ -1183,6 +1183,7 @@ gnu/java/text/LineBreakIterator.java \
6f1b0c
 gnu/java/text/SentenceBreakIterator.java	\
6f1b0c
 gnu/java/text/WordBreakIterator.java \
6f1b0c
 gnu/java/util/DoubleEnumeration.java \
6f1b0c
+gnu/java/util/ZoneInfo.java \
6f1b0c
 java/lang/ref/PhantomReference.java \
6f1b0c
 java/lang/ref/Reference.java \
6f1b0c
 java/lang/ref/ReferenceQueue.java \
6f1b0c
@@ -2017,7 +2018,8 @@ DEP_FILES =  .deps/$(srcdir)/$(CONVERT_D
6f1b0c
 .deps/gnu/java/text/LineBreakIterator.P \
6f1b0c
 .deps/gnu/java/text/SentenceBreakIterator.P \
6f1b0c
 .deps/gnu/java/text/WordBreakIterator.P \
6f1b0c
-.deps/gnu/java/util/DoubleEnumeration.P .deps/interpret.P \
6f1b0c
+.deps/gnu/java/util/DoubleEnumeration.P \
6f1b0c
+.deps/gnu/java/util/ZoneInfo.P .deps/interpret.P \
6f1b0c
 .deps/java/applet/Applet.P .deps/java/applet/AppletContext.P \
6f1b0c
 .deps/java/applet/AppletStub.P .deps/java/applet/AudioClip.P \
6f1b0c
 .deps/java/awt/AWTError.P .deps/java/awt/AWTEvent.P \
6f1b0c
--- libjava/java/util/GregorianCalendar.java.jj	2007-02-23 21:17:36.000000000 +0100
6f1b0c
+++ libjava/java/util/GregorianCalendar.java	2007-02-26 09:54:12.000000000 +0100
6f1b0c
@@ -111,6 +111,13 @@ public class GregorianCalendar extends C
6f1b0c
     this(TimeZone.getDefault(), locale);
6f1b0c
   }
6f1b0c
 
6f1b0c
+  private GregorianCalendar(TimeZone zone, Locale locale, boolean unused)
6f1b0c
+  {
6f1b0c
+    super(zone, locale);
6f1b0c
+    ResourceBundle rb = ResourceBundle.getBundle(bundleName, locale);
6f1b0c
+    gregorianCutover = ((Date) rb.getObject("gregorianCutOver")).getTime();
6f1b0c
+  }
6f1b0c
+
6f1b0c
   /**
6f1b0c
    * Constructs a new GregorianCalender representing the current
6f1b0c
    * time with the given time zone and the given locale.
6f1b0c
@@ -119,9 +126,7 @@ public class GregorianCalendar extends C
6f1b0c
    */
6f1b0c
   public GregorianCalendar(TimeZone zone, Locale locale)
6f1b0c
   {
6f1b0c
-    super(zone, locale);
6f1b0c
-    ResourceBundle rb = ResourceBundle.getBundle(bundleName, locale);
6f1b0c
-    gregorianCutover = ((Date) rb.getObject("gregorianCutOver")).getTime();
6f1b0c
+    this(zone, locale, false);
6f1b0c
     setTimeInMillis(System.currentTimeMillis());
6f1b0c
   }
6f1b0c
 
6f1b0c
@@ -134,7 +139,8 @@ public class GregorianCalendar extends C
6f1b0c
    */
6f1b0c
   public GregorianCalendar(int year, int month, int day)
6f1b0c
   {
6f1b0c
-    super();
6f1b0c
+    this(TimeZone.getDefault(), Locale.getDefault(), false);
6f1b0c
+    clear();
6f1b0c
     set(year, month, day);
6f1b0c
   }
6f1b0c
 
6f1b0c
@@ -149,7 +155,8 @@ public class GregorianCalendar extends C
6f1b0c
    */
6f1b0c
   public GregorianCalendar(int year, int month, int day, int hour, int minute)
6f1b0c
   {
6f1b0c
-    super();
6f1b0c
+    this(TimeZone.getDefault(), Locale.getDefault(), false);
6f1b0c
+    clear();
6f1b0c
     set(year, month, day, hour, minute);
6f1b0c
   }
6f1b0c
 
6f1b0c
@@ -166,7 +173,8 @@ public class GregorianCalendar extends C
6f1b0c
   public GregorianCalendar(int year, int month, int day,
6f1b0c
 			   int hour, int minute, int second)
6f1b0c
   {
6f1b0c
-    super();
6f1b0c
+    this(TimeZone.getDefault(), Locale.getDefault(), false);
6f1b0c
+    clear();
6f1b0c
     set(year, month, day, hour, minute, second);
6f1b0c
   }
6f1b0c
 
6f1b0c
@@ -254,8 +262,10 @@ public class GregorianCalendar extends C
6f1b0c
 	//
6f1b0c
 	// The additional leap year factor accounts for the fact that
6f1b0c
 	// a leap day is not seen on Jan 1 of the leap year.
6f1b0c
+	// And on and after the leap day, the leap day has already been
6f1b0c
+	// included in dayOfYear.
6f1b0c
 	int gregOffset = (year / 400) - (year / 100) + 2;
6f1b0c
-	if (isLeapYear (year, true) && dayOfYear < 31 + 29)
6f1b0c
+	if (isLeapYear (year, true))
6f1b0c
 	  --gregOffset;
6f1b0c
 	time += gregOffset * (24 * 60 * 60 * 1000L);
6f1b0c
       }
6f1b0c
--- libjava/java/util/SimpleTimeZone.java.jj	2007-02-23 21:17:36.000000000 +0100
6f1b0c
+++ libjava/java/util/SimpleTimeZone.java	2007-02-23 21:27:21.000000000 +0100
6f1b0c
@@ -458,16 +458,34 @@ public class SimpleTimeZone extends Time
6f1b0c
     int daylightSavings = 0;
6f1b0c
     if (useDaylight && era == GregorianCalendar.AD && year >= startYear)
6f1b0c
       {
6f1b0c
+	int orig_year = year;
6f1b0c
 	// This does only work for Gregorian calendars :-(
6f1b0c
 	// This is mainly because setStartYear doesn't take an era.
6f1b0c
 
6f1b0c
 	boolean afterStart = !isBefore(year, month, day, dayOfWeek, millis,
6f1b0c
 				       startMode, startMonth,
6f1b0c
 				       startDay, startDayOfWeek, startTime);
6f1b0c
+	millis += dstSavings;
6f1b0c
+	if (millis >= 24 * 60 * 60 * 1000)
6f1b0c
+	  {
6f1b0c
+	    millis -= 24 * 60 * 60 * 1000;
6f1b0c
+	    dayOfWeek = (dayOfWeek % 7) + 1;
6f1b0c
+	    if (++day > getDaysInMonth(month, year))
6f1b0c
+	      {
6f1b0c
+		day = 1;
6f1b0c
+		if (month++ == Calendar.DECEMBER)
6f1b0c
+		  {
6f1b0c
+		    month = Calendar.JANUARY;
6f1b0c
+		    year++;
6f1b0c
+		  }
6f1b0c
+	      }
6f1b0c
+	  }
6f1b0c
 	boolean beforeEnd = isBefore(year, month, day, dayOfWeek, millis,
6f1b0c
 				     endMode, endMonth,
6f1b0c
 				     endDay, endDayOfWeek, endTime);
6f1b0c
 
6f1b0c
+	if (orig_year != year)
6f1b0c
+	  afterStart = false;
6f1b0c
 	if (startMonth < endMonth)
6f1b0c
 	  {
6f1b0c
 	    // use daylight savings, if the date is after the start of
6f1b0c
--- libjava/java/util/Date.java.jj	2007-02-23 21:17:36.000000000 +0100
6f1b0c
+++ libjava/java/util/Date.java	2007-02-26 09:43:28.000000000 +0100
6f1b0c
@@ -304,34 +304,6 @@ public class Date implements Cloneable, 
6f1b0c
     return format.format(this);
6f1b0c
   }
6f1b0c
 
6f1b0c
-  private static int skipParens(String string, int offset)
6f1b0c
-  {
6f1b0c
-    int len = string.length();
6f1b0c
-    int p = 0;
6f1b0c
-    int i;
6f1b0c
-
6f1b0c
-    for (i = offset; i < len; ++i)
6f1b0c
-      {
6f1b0c
-	if (string.charAt(i) == '(')
6f1b0c
-	  ++p;
6f1b0c
-	else if (string.charAt(i) == ')')
6f1b0c
-	  {
6f1b0c
-	    --p;
6f1b0c
-	    if (p == 0)
6f1b0c
-	      return i + 1;
6f1b0c
-	    // If we've encounted unbalanced parens, just return the
6f1b0c
-	    // leftover one as an ordinary character.  It will be
6f1b0c
-	    // caught later in parsing and cause an
6f1b0c
-	    // IllegalArgumentException.
6f1b0c
-      	    if (p < 0)
6f1b0c
-	      return i;
6f1b0c
-	  }
6f1b0c
-      }
6f1b0c
-
6f1b0c
-    // Not sure what to do if `p != 0' here.
6f1b0c
-    return i;
6f1b0c
-  }
6f1b0c
-
6f1b0c
   private static int parseTz(String tok, char sign)
6f1b0c
     throws IllegalArgumentException
6f1b0c
   {
6f1b0c
@@ -408,20 +380,25 @@ public class Date implements Cloneable, 
6f1b0c
 
6f1b0c
     // Trim out any nested stuff in parentheses now to make parsing easier.
6f1b0c
     StringBuffer buf = new StringBuffer();
6f1b0c
-    int off = 0;
6f1b0c
-    int openParenOffset, tmpMonth;
6f1b0c
-    while ((openParenOffset = string.indexOf('(', off)) >= 0)
6f1b0c
+    int parenNesting = 0;
6f1b0c
+    int len = string.length();
6f1b0c
+    for (int i = 0;  i < len;  i++)
6f1b0c
       {
6f1b0c
-	// Copy part of string leading up to open paren.
6f1b0c
-	buf.append(string.substring(off, openParenOffset));
6f1b0c
-	off = skipParens(string, openParenOffset);
6f1b0c
+	char ch = string.charAt(i);
6f1b0c
+	if (ch >= 'a' && ch <= 'z')
6f1b0c
+	  ch -= 'a' - 'A';
6f1b0c
+	if (ch == '(')
6f1b0c
+	  parenNesting++;
6f1b0c
+	else if (parenNesting == 0)
6f1b0c
+	  buf.append(ch);
6f1b0c
+	else if (ch == ')')
6f1b0c
+	  parenNesting--;
6f1b0c
       }
6f1b0c
-    buf.append(string.substring(off));
6f1b0c
+    int tmpMonth;
6f1b0c
 
6f1b0c
     // Make all chars upper case to simplify comparisons later.
6f1b0c
     // Also ignore commas; treat them as delimiters.
6f1b0c
-    StringTokenizer strtok =
6f1b0c
-      new StringTokenizer(buf.toString().toUpperCase(), " \t\n\r,");
6f1b0c
+    StringTokenizer strtok = new StringTokenizer(buf.toString(), " \t\n\r,");
6f1b0c
 
6f1b0c
     while (strtok.hasMoreTokens())
6f1b0c
       {
6f1b0c
@@ -434,58 +411,69 @@ public class Date implements Cloneable, 
6f1b0c
 	  }
6f1b0c
 	else if (firstch >= '0' && firstch <= '9')
6f1b0c
 	  {
6f1b0c
+	    int lastPunct = -1;
6f1b0c
 	    while (tok != null && tok.length() > 0)
6f1b0c
 	      {
6f1b0c
-	        // A colon or slash may be valid in the number.
6f1b0c
-	        // Find the first of these before calling parseInt.
6f1b0c
-	        int colon = tok.indexOf(':');
6f1b0c
-	        int slash = tok.indexOf('/');
6f1b0c
-	        int hyphen = tok.indexOf('-');
6f1b0c
-		// We choose tok.length initially because it makes
6f1b0c
-		// processing simpler.
6f1b0c
-	        int punctOffset = tok.length();
6f1b0c
-		if (colon >= 0)
6f1b0c
-		  punctOffset = Math.min(punctOffset, colon);
6f1b0c
-	        if (slash >= 0)
6f1b0c
-	          punctOffset = Math.min(punctOffset, slash);
6f1b0c
-	        if (hyphen >= 0)
6f1b0c
-	          punctOffset = Math.min(punctOffset, hyphen);
6f1b0c
-		// Following code relies on -1 being the exceptional
6f1b0c
-		// case.
6f1b0c
-		if (punctOffset == tok.length())
6f1b0c
-		  punctOffset = -1;
6f1b0c
-
6f1b0c
-	        int num;
6f1b0c
-	        try
6f1b0c
-	          {
6f1b0c
-		    num = Integer.parseInt(punctOffset < 0 ? tok :
6f1b0c
-					   tok.substring(0, punctOffset));
6f1b0c
-	          }
6f1b0c
-	        catch (NumberFormatException ex)
6f1b0c
-	          {
6f1b0c
-		    throw new IllegalArgumentException(tok);
6f1b0c
-	          }
6f1b0c
-
6f1b0c
-		// TBD: Spec says year can be followed by a slash.  That might
6f1b0c
-		// make sense if using YY/MM/DD formats, but it would fail in
6f1b0c
-		// that format for years <= 70.  Also, what about 1900?  That
6f1b0c
-		// is interpreted as the year 3800; seems that the comparison
6f1b0c
-		// should be num >= 1900 rather than just > 1900.
6f1b0c
-		// What about a year of 62 - 70?  (61 or less could be a (leap)
6f1b0c
-		// second).  70/MM/DD cause an exception but 71/MM/DD is ok
6f1b0c
-		// even though there's no ambiguity in either case.
6f1b0c
-		// For the parse method, the spec as written seems too loose.
6f1b0c
-		// Until shown otherwise, we'll follow the spec as written.
6f1b0c
-	        if (num > 70 && (punctOffset < 0 || punctOffset == slash))
6f1b0c
-		  year = num > 1900 ? num - 1900 : num;
6f1b0c
-		else if (punctOffset > 0 && punctOffset == colon)
6f1b0c
+		int punctOffset = tok.length();
6f1b0c
+		int num = 0;
6f1b0c
+		int punct;
6f1b0c
+		for (int i = 0;  ;  i++)
6f1b0c
+		  {
6f1b0c
+		    if (i >= punctOffset)
6f1b0c
+		      {
6f1b0c
+			punct = -1;
6f1b0c
+			break;
6f1b0c
+		      }
6f1b0c
+		    else
6f1b0c
+		      {
6f1b0c
+			punct = tok.charAt(i);
6f1b0c
+			if (punct >= '0' && punct <= '9')
6f1b0c
+			  {
6f1b0c
+			    if (num > 999999999) // in case of overflow
6f1b0c
+			      throw new IllegalArgumentException(tok);
6f1b0c
+			    num = 10 * num + (punct - '0');
6f1b0c
+			  }
6f1b0c
+			else
6f1b0c
+			  {
6f1b0c
+			    punctOffset = i;
6f1b0c
+			    break;
6f1b0c
+			  }
6f1b0c
+		      }
6f1b0c
+		      
6f1b0c
+		  }
6f1b0c
+
6f1b0c
+		if (punct == ':')
6f1b0c
 		  {
6f1b0c
 		    if (hour < 0)
6f1b0c
 		      hour = num;
6f1b0c
 		    else
6f1b0c
 		      minute = num;
6f1b0c
 		  }
6f1b0c
-		else if (punctOffset > 0 && punctOffset == slash)
6f1b0c
+		else if (lastPunct == ':' && hour >= 0 && (minute < 0 || second < 0))
6f1b0c
+		  {
6f1b0c
+		    if (minute < 0)
6f1b0c
+		      minute = num;
6f1b0c
+		    else
6f1b0c
+		      second = num;
6f1b0c
+		  }
6f1b0c
+	        else if ((num >= 70
6f1b0c
+			  && (punct == ' ' || punct == ','
6f1b0c
+			      || punct == '/' || punct < 0))
6f1b0c
+			 || (num < 70 && day >= 0 && month >= 0 && year < 0))
6f1b0c
+		  {
6f1b0c
+		    if (num >= 100)
6f1b0c
+		      year = num;
6f1b0c
+		    else
6f1b0c
+		      {
6f1b0c
+			int curYear = 1900 + new Date().getYear();
6f1b0c
+			int firstYear = curYear - 80;
6f1b0c
+			year = firstYear / 100 * 100 + num;
6f1b0c
+			int yx = year;
6f1b0c
+			if (year < firstYear)
6f1b0c
+			  year += 100;
6f1b0c
+		      }
6f1b0c
+		  }
6f1b0c
+		else if (punct == '/')
6f1b0c
 		  {
6f1b0c
 		    if (month < 0)
6f1b0c
 		      month = num - 1;
6f1b0c
@@ -502,10 +490,11 @@ public class Date implements Cloneable, 
6f1b0c
 		  throw new IllegalArgumentException(tok);
6f1b0c
 
6f1b0c
 		// Advance string if there's more to process in this token.
6f1b0c
-		if (punctOffset < 0 || punctOffset + 1 >= tok.length())
6f1b0c
+		if (punct < 0 || punctOffset + 1 >= tok.length())
6f1b0c
 		  tok = null;
6f1b0c
 		else
6f1b0c
 		  tok = tok.substring(punctOffset + 1);
6f1b0c
+		lastPunct = punct;
6f1b0c
 	      }
6f1b0c
 	  }
6f1b0c
 	else if (firstch >= 'A' && firstch <= 'Z')
6f1b0c
@@ -573,22 +562,29 @@ public class Date implements Cloneable, 
6f1b0c
 	  throw new IllegalArgumentException(tok);
6f1b0c
       }
6f1b0c
 
6f1b0c
-    // Unspecified minutes and seconds should default to 0.
6f1b0c
+    // Unspecified hours, minutes, or seconds should default to 0.
6f1b0c
+    if (hour < 0)
6f1b0c
+      hour = 0;
6f1b0c
     if (minute < 0)
6f1b0c
       minute = 0;
6f1b0c
     if (second < 0)
6f1b0c
       second = 0;
6f1b0c
 
6f1b0c
     // Throw exception if any other fields have not been recognized and set.
6f1b0c
-    if (year < 0 || month < 0 || day < 0 || hour < 0)
6f1b0c
+    if (year < 0 || month < 0 || day < 0)
6f1b0c
       throw new IllegalArgumentException("Missing field");
6f1b0c
 
6f1b0c
     // Return the time in either local time or relative to GMT as parsed.
6f1b0c
     // If no time-zone was specified, get the local one (in minutes) and
6f1b0c
     // convert to milliseconds before adding to the UTC.
6f1b0c
-    return UTC(year, month, day, hour, minute, second) + (localTimezone ?
6f1b0c
-		new Date(year, month, day).getTimezoneOffset() * 60 * 1000:
6f1b0c
-		-timezone * 60 * 1000);
6f1b0c
+    GregorianCalendar cal
6f1b0c
+      = new GregorianCalendar(year, month, day, hour, minute, second);
6f1b0c
+    if (!localTimezone)
6f1b0c
+      {
6f1b0c
+	cal.set(Calendar.ZONE_OFFSET, timezone * 60 * 1000);
6f1b0c
+	cal.set(Calendar.DST_OFFSET, 0);
6f1b0c
+      }
6f1b0c
+    return cal.getTimeInMillis();
6f1b0c
   }
6f1b0c
 
6f1b0c
   /**
6f1b0c
--- libjava/java/lang/natSystem.cc.jj	2007-02-23 21:17:31.000000000 +0100
6f1b0c
+++ libjava/java/lang/natSystem.cc	2007-02-24 22:04:41.000000000 +0100
6f1b0c
@@ -51,6 +51,8 @@ details.  */
6f1b0c
 #include <java/lang/Class.h>
6f1b0c
 #include <java/lang/ArrayStoreException.h>
6f1b0c
 #include <java/lang/ArrayIndexOutOfBoundsException.h>
6f1b0c
+#include <java/lang/Character.h>
6f1b0c
+#include <java/lang/Integer.h>
6f1b0c
 #include <java/lang/NullPointerException.h>
6f1b0c
 #include <java/lang/StringBuffer.h>
6f1b0c
 #include <java/util/Properties.h>
6f1b0c
@@ -229,61 +231,6 @@ getpwuid_adaptor(T_passwd * (*getpwuid_r
6f1b0c
 }
6f1b0c
 #endif
6f1b0c
 
6f1b0c
-/*
6f1b0c
- * This method returns a time zone string that is used by init_properties
6f1b0c
- * to set the default timezone property 'user.timezone'.  That value is
6f1b0c
- * used by default as a key into the timezone table used by the
6f1b0c
- * java::util::TimeZone class.
6f1b0c
- */
6f1b0c
-jstring
6f1b0c
-java::lang::System::getSystemTimeZone (void)
6f1b0c
-{
6f1b0c
-  struct tm *tim;
6f1b0c
-  time_t current_time;
6f1b0c
-  long tzoffset;
6f1b0c
-  const char *tz1, *tz2;
6f1b0c
-  char *tzid;
6f1b0c
-
6f1b0c
-  current_time = time(0);
6f1b0c
-
6f1b0c
-  mktime(tim = localtime(&current_time));
6f1b0c
-#ifdef STRUCT_TM_HAS_GMTOFF
6f1b0c
-  // tm_gmtoff is secs EAST of UTC.
6f1b0c
-  tzoffset = -(tim->tm_gmtoff) + tim->tm_isdst * 3600L;
6f1b0c
-#elif HAVE_TIMEZONE
6f1b0c
-  // timezone is secs WEST of UTC.
6f1b0c
-  tzoffset = timezone;	
6f1b0c
-#else
6f1b0c
-  // FIXME: there must be another global if neither tm_gmtoff nor timezone
6f1b0c
-  // is available, esp. if tzname is valid.
6f1b0c
-  // Richard Earnshaw <rearnsha@arm.com> has suggested using difftime to
6f1b0c
-  // calculate between gmtime and localtime (and accounting for possible
6f1b0c
-  // daylight savings time) as an alternative.
6f1b0c
-  tzoffset = 0L;
6f1b0c
-#endif
6f1b0c
-
6f1b0c
-#ifdef HAVE_TM_ZONE
6f1b0c
-  tz1 = tim->tm_zone;
6f1b0c
-  tz2 = "";
6f1b0c
-#elif defined (HAVE_TZNAME)
6f1b0c
-  tz1 = tzname[0];
6f1b0c
-  tz2 = strcmp (tzname[0], tzname[1]) ? tzname[1] : "";
6f1b0c
-#else
6f1b0c
-  // Some targets have no concept of timezones.
6f1b0c
-  tz1 = "???";
6f1b0c
-  tz2 = tz1;
6f1b0c
-#endif
6f1b0c
-
6f1b0c
-  if ((tzoffset % 3600) == 0)
6f1b0c
-    tzoffset = tzoffset / 3600;
6f1b0c
-
6f1b0c
-  tzid = (char*) _Jv_Malloc (strlen(tz1) + strlen(tz2) + 6);
6f1b0c
-  sprintf(tzid, "%s%ld%s", tz1, tzoffset, tz2);
6f1b0c
-  jstring retval = JvNewStringUTF (tzid);
6f1b0c
-  _Jv_Free (tzid);
6f1b0c
-
6f1b0c
-  return retval;
6f1b0c
-}
6f1b0c
 
6f1b0c
 extern void _Jv_SetDLLSearchPath (const char *);
6f1b0c
 
6f1b0c
@@ -441,11 +388,6 @@ java::lang::System::init_properties (voi
6f1b0c
       SET ("user.region", "US");
6f1b0c
     }  
6f1b0c
 
6f1b0c
-  // Set the "user.timezone" property.
6f1b0c
-  jstring timezone = getDefaultTimeZoneId ();
6f1b0c
-  if (timezone != NULL)
6f1b0c
-    newprops->put (JvNewStringLatin1 ("user.timezone"), timezone);
6f1b0c
-
6f1b0c
   // Set some properties according to whatever was compiled in with
6f1b0c
   // `-D'.
6f1b0c
   for (int i = 0; _Jv_Compiler_Properties[i]; ++i)
6f1b0c
@@ -529,3 +471,146 @@ java::lang::System::init_properties (voi
6f1b0c
   // synchronized in the common case.
6f1b0c
   properties = newprops;
6f1b0c
 }
6f1b0c
+
6f1b0c
+/*
6f1b0c
+ * This method returns a time zone string that is used by init_properties
6f1b0c
+ * to set the default timezone property 'user.timezone'.  That value is
6f1b0c
+ * used by default as a key into the timezone table used by the
6f1b0c
+ * java::util::TimeZone class.
6f1b0c
+ */
6f1b0c
+static jstring
6f1b0c
+getSystemTimeZone (void)
6f1b0c
+{
6f1b0c
+  struct tm *tim;
6f1b0c
+  time_t current_time;
6f1b0c
+  long tzoffset;
6f1b0c
+  const char *tz1, *tz2;
6f1b0c
+  char *tzid;
6f1b0c
+
6f1b0c
+  current_time = time(0);
6f1b0c
+
6f1b0c
+  mktime(tim = localtime(&current_time));
6f1b0c
+#ifdef STRUCT_TM_HAS_GMTOFF
6f1b0c
+  // tm_gmtoff is secs EAST of UTC.
6f1b0c
+  tzoffset = -(tim->tm_gmtoff) + tim->tm_isdst * 3600L;
6f1b0c
+#elif HAVE_TIMEZONE
6f1b0c
+  // timezone is secs WEST of UTC.
6f1b0c
+  tzoffset = timezone;	
6f1b0c
+#else
6f1b0c
+  // FIXME: there must be another global if neither tm_gmtoff nor timezone
6f1b0c
+  // is available, esp. if tzname is valid.
6f1b0c
+  // Richard Earnshaw <rearnsha@arm.com> has suggested using difftime to
6f1b0c
+  // calculate between gmtime and localtime (and accounting for possible
6f1b0c
+  // daylight savings time) as an alternative.
6f1b0c
+  tzoffset = 0L;
6f1b0c
+#endif
6f1b0c
+
6f1b0c
+#ifdef HAVE_TM_ZONE
6f1b0c
+  tz1 = tim->tm_zone;
6f1b0c
+  tz2 = "";
6f1b0c
+#elif defined (HAVE_TZNAME)
6f1b0c
+  tz1 = tzname[0];
6f1b0c
+  tz2 = strcmp (tzname[0], tzname[1]) ? tzname[1] : "";
6f1b0c
+#else
6f1b0c
+  // Some targets have no concept of timezones.
6f1b0c
+  tz1 = "???";
6f1b0c
+  tz2 = tz1;
6f1b0c
+#endif
6f1b0c
+
6f1b0c
+  if ((tzoffset % 3600) == 0)
6f1b0c
+    tzoffset = tzoffset / 3600;
6f1b0c
+
6f1b0c
+  tzid = (char*) _Jv_Malloc (strlen(tz1) + strlen(tz2) + 6);
6f1b0c
+  sprintf(tzid, "%s%ld%s", tz1, tzoffset, tz2);
6f1b0c
+  jstring retval = JvNewStringUTF (tzid);
6f1b0c
+  _Jv_Free (tzid);
6f1b0c
+
6f1b0c
+  return retval;
6f1b0c
+}
6f1b0c
+
6f1b0c
+// Get the System Timezone as reported by the OS.  It should be in
6f1b0c
+// the form PST8PDT so we'll need to parse it and check that it's valid.
6f1b0c
+// FIXME: Using the code from Classpath for generating the System
6f1b0c
+// Timezone IMO is suboptimal because it ignores whether the rules for
6f1b0c
+// DST match up.
6f1b0c
+jstring
6f1b0c
+java::util::TimeZone::getDefaultTimeZoneId ()
6f1b0c
+{
6f1b0c
+  jstring sysTimeZoneId = getSystemTimeZone ();
6f1b0c
+
6f1b0c
+  using namespace java::lang;
6f1b0c
+
6f1b0c
+  // Check if this is a valid timezone.  Make sure the IDs match
6f1b0c
+  // since getTimeZone returns GMT if no match is found.
6f1b0c
+  TimeZone *tz = TimeZone::getTimeZone (sysTimeZoneId);
6f1b0c
+  if (tz->getID ()->equals (sysTimeZoneId))
6f1b0c
+    return sysTimeZoneId;
6f1b0c
+
6f1b0c
+  // Check if the base part of sysTimeZoneId is a valid timezone that
6f1b0c
+  // matches with daylight usage and rawOffset.  Make sure the IDs match
6f1b0c
+  // since getTimeZone returns GMT if no match is found.
6f1b0c
+  // First find start of GMT offset info and any Daylight zone name.
6f1b0c
+  int startGMToffset = 0;
6f1b0c
+  int sysTimeZoneIdLength = sysTimeZoneId->length();
6f1b0c
+  for (int i = 0; i < sysTimeZoneIdLength && startGMToffset == 0; i++)
6f1b0c
+    {
6f1b0c
+      if (Character::isDigit (sysTimeZoneId->charAt (i)))
6f1b0c
+	startGMToffset = i;
6f1b0c
+    }
6f1b0c
+
6f1b0c
+  int startDaylightZoneName = 0;
6f1b0c
+  jboolean usesDaylight = false;
6f1b0c
+  for (int i = sysTimeZoneIdLength - 1;
6f1b0c
+       i >= 0 && !Character::isDigit (sysTimeZoneId->charAt (i)); --i)
6f1b0c
+    {
6f1b0c
+      startDaylightZoneName = i;
6f1b0c
+    }
6f1b0c
+  if (startDaylightZoneName > 0)
6f1b0c
+    usesDaylight = true;
6f1b0c
+
6f1b0c
+  int GMToffset
6f1b0c
+    = Integer::parseInt (startDaylightZoneName == 0 ?
6f1b0c
+			 sysTimeZoneId->substring (startGMToffset) :
6f1b0c
+			 sysTimeZoneId->substring (startGMToffset,
6f1b0c
+						   startDaylightZoneName));
6f1b0c
+
6f1b0c
+  // Offset could be in hours or seconds.  Convert to millis.
6f1b0c
+  if (GMToffset < 24)
6f1b0c
+    GMToffset *= 60 * 60;
6f1b0c
+  GMToffset *= -1000;
6f1b0c
+
6f1b0c
+  jstring tzBasename = sysTimeZoneId->substring (0, startGMToffset);
6f1b0c
+  tz = TimeZone::getTimeZone (tzBasename);
6f1b0c
+  if (tz->getID ()->equals (tzBasename) && tz->getRawOffset () == GMToffset)
6f1b0c
+    {
6f1b0c
+      jboolean tzUsesDaylight = tz->useDaylightTime ();
6f1b0c
+      if (usesDaylight && tzUsesDaylight || !usesDaylight && !tzUsesDaylight)
6f1b0c
+	return tzBasename;
6f1b0c
+    }
6f1b0c
+
6f1b0c
+  // If no match, see if a valid timezone has the same attributes as this
6f1b0c
+  // and then use it instead.
6f1b0c
+  jstringArray IDs = TimeZone::getAvailableIDs (GMToffset);
6f1b0c
+  jstring *elts = elements (IDs);
6f1b0c
+  for (int i = 0; i < IDs->length; ++i)
6f1b0c
+    {
6f1b0c
+      // FIXME: The daylight savings rules may not match the rules
6f1b0c
+      // for the desired zone.
6f1b0c
+      jboolean IDusesDaylight =
6f1b0c
+	TimeZone::getTimeZone (elts[i])->useDaylightTime ();
6f1b0c
+      if (usesDaylight && IDusesDaylight || !usesDaylight && !IDusesDaylight)
6f1b0c
+	return elts[i];
6f1b0c
+    }
6f1b0c
+
6f1b0c
+  // If all else fails, return null.
6f1b0c
+  return NULL;
6f1b0c
+}
6f1b0c
+
6f1b0c
+jstring
6f1b0c
+java::util::TimeZone::getTZEnvVar ()
6f1b0c
+{
6f1b0c
+  const char *tzenv = ::getenv ("TZ");
6f1b0c
+  if (tzenv == NULL)
6f1b0c
+    return NULL;
6f1b0c
+  return JvNewStringUTF (tzenv);
6f1b0c
+}
6f1b0c
--- libjava/java/util/TimeZone.java.jj	2007-02-23 21:17:36.000000000 +0100
6f1b0c
+++ libjava/java/util/TimeZone.java	2007-02-24 21:54:41.000000000 +0100
6f1b0c
@@ -1,5 +1,6 @@
6f1b0c
 /* java.util.TimeZone
6f1b0c
-   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
6f1b0c
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
6f1b0c
+   Free Software Foundation, Inc.
6f1b0c
 
6f1b0c
 This file is part of GNU Classpath.
6f1b0c
 
6f1b0c
@@ -37,6 +38,13 @@ exception statement from your version. *
6f1b0c
 
6f1b0c
 
6f1b0c
 package java.util;
6f1b0c
+import gnu.java.util.ZoneInfo;
6f1b0c
+import java.io.BufferedInputStream;
6f1b0c
+import java.io.BufferedReader;
6f1b0c
+import java.io.File;
6f1b0c
+import java.io.FileInputStream;
6f1b0c
+import java.io.InputStreamReader;
6f1b0c
+import java.io.IOException;
6f1b0c
 import java.text.DateFormatSymbols;
6f1b0c
 
6f1b0c
 /**
6f1b0c
@@ -79,690 +87,1215 @@ public abstract class TimeZone implement
6f1b0c
   /**
6f1b0c
    * The default time zone, as returned by getDefault.
6f1b0c
    */
6f1b0c
-  private static TimeZone defaultZone;
6f1b0c
+  private static TimeZone defaultZone0;
6f1b0c
+  /* initialize this static field lazily to overhead if
6f1b0c
+   * it is not needed: 
6f1b0c
+   */
6f1b0c
+  private static synchronized TimeZone defaultZone() {
6f1b0c
+    /* Look up default timezone */
6f1b0c
+    if (defaultZone0 == null) 
6f1b0c
+      {
6f1b0c
+        // System.loadLibrary("javautil");
6f1b0c
+	String tzid = System.getProperty("user.timezone");
6f1b0c
+
6f1b0c
+	if (tzid == null)
6f1b0c
+	  {
6f1b0c
+	    tzid = getTZEnvVar();
6f1b0c
+	    if (tzid != null && tzid.equals(""))
6f1b0c
+	      tzid = null;
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	if (tzid == null)
6f1b0c
+	  {
6f1b0c
+	    TimeZone zone = ZoneInfo.readTZFile((String) null, "/etc/localtime");
6f1b0c
+	    if (zone != null)
6f1b0c
+	      {
6f1b0c
+		// Try to find a more suitable ID for the /etc/localtime
6f1b0c
+		// timezone.
6f1b0c
+		// Sometimes /etc/localtime is a symlink to some
6f1b0c
+		// /usr/share/zoneinfo/ file.
6f1b0c
+		String id = null;
6f1b0c
+		try
6f1b0c
+		  {
6f1b0c
+		    id = new File("/etc/localtime").getCanonicalPath();
6f1b0c
+		    if (id != null)
6f1b0c
+		      {
6f1b0c
+			String zoneinfo_dir
6f1b0c
+			  = System.getProperty("gnu.java.util.zoneinfo.dir");
6f1b0c
+			if (zoneinfo_dir != null)
6f1b0c
+			  zoneinfo_dir
6f1b0c
+			    = new File(zoneinfo_dir
6f1b0c
+				       + File.separatorChar).getCanonicalPath();
6f1b0c
+			if (zoneinfo_dir != null && id.startsWith(zoneinfo_dir))
6f1b0c
+			  {
6f1b0c
+			    int pos = zoneinfo_dir.length();
6f1b0c
+			    while (pos < id.length()
6f1b0c
+				   && id.charAt(pos) == File.separatorChar)
6f1b0c
+			      pos++;
6f1b0c
+			    if (pos < id.length())
6f1b0c
+			      id = id.substring(pos);
6f1b0c
+			    else
6f1b0c
+			      id = null;
6f1b0c
+			  }
6f1b0c
+			else
6f1b0c
+			  id = null;
6f1b0c
+		      }
6f1b0c
+		  }
6f1b0c
+		catch (IOException ioe)
6f1b0c
+		  {
6f1b0c
+		    id = null;
6f1b0c
+		  }
6f1b0c
+
6f1b0c
+		if (id == null)
6f1b0c
+		  id = readSysconfigClockFile("/etc/sysconfig/clock");
6f1b0c
+
6f1b0c
+		if (id != null)
6f1b0c
+		  zone.setID(id);
6f1b0c
+		defaultZone0 = zone;
6f1b0c
+		return defaultZone0;
6f1b0c
+	      }
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	if (tzid == null)
6f1b0c
+	  tzid = getDefaultTimeZoneId();
6f1b0c
+
6f1b0c
+	if (tzid == null)
6f1b0c
+	  tzid = "GMT";
6f1b0c
+
6f1b0c
+	defaultZone0 = getDefaultTimeZone(tzid);
6f1b0c
+      }
6f1b0c
+    return defaultZone0; 
6f1b0c
+  }
6f1b0c
+
6f1b0c
 
6f1b0c
   private static final long serialVersionUID = 3581463369166924961L;
6f1b0c
 
6f1b0c
   /**
6f1b0c
-   * Hashtable for timezones by ID.  
6f1b0c
+   * Flag whether zoneinfo data should be used,
6f1b0c
+   * otherwise builtin timezone data will be provided.
6f1b0c
    */
6f1b0c
-  private static final Hashtable timezones = new Hashtable();
6f1b0c
+  private static String zoneinfo_dir;
6f1b0c
 
6f1b0c
-  static
6f1b0c
-  {
6f1b0c
-    TimeZone tz;
6f1b0c
-    // Automatically generated by scripts/timezones.pl
6f1b0c
-    // XXX - Should we read this data from a file?
6f1b0c
-    tz = new SimpleTimeZone(-11000 * 3600, "MIT");
6f1b0c
-    timezones.put("MIT", tz);
6f1b0c
-    timezones.put("Pacific/Apia", tz);
6f1b0c
-    timezones.put("Pacific/Midway", tz);
6f1b0c
-    timezones.put("Pacific/Niue", tz);
6f1b0c
-    timezones.put("Pacific/Pago_Pago", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-10000 * 3600, "America/Adak",
6f1b0c
-       Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("America/Adak", tz);
6f1b0c
-    tz = new SimpleTimeZone(-10000 * 3600, "HST");
6f1b0c
-    timezones.put("HST", tz);
6f1b0c
-    timezones.put("Pacific/Fakaofo", tz);
6f1b0c
-    timezones.put("Pacific/Honolulu", tz);
6f1b0c
-    timezones.put("Pacific/Johnston", tz);
6f1b0c
-    timezones.put("Pacific/Rarotonga", tz);
6f1b0c
-    timezones.put("Pacific/Tahiti", tz);
6f1b0c
-    tz = new SimpleTimeZone(-9500 * 3600, "Pacific/Marquesas");
6f1b0c
-    timezones.put("Pacific/Marquesas", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-9000 * 3600, "AST",
6f1b0c
-       Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("AST", tz);
6f1b0c
-    timezones.put("America/Anchorage", tz);
6f1b0c
-    timezones.put("America/Juneau", tz);
6f1b0c
-    timezones.put("America/Nome", tz);
6f1b0c
-    timezones.put("America/Yakutat", tz);
6f1b0c
-    tz = new SimpleTimeZone(-9000 * 3600, "Pacific/Gambier");
6f1b0c
-    timezones.put("Pacific/Gambier", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-8000 * 3600, "PST",
6f1b0c
-       Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("PST", tz);
6f1b0c
-    timezones.put("PST8PDT", tz);
6f1b0c
-    timezones.put("America/Dawson", tz);
6f1b0c
-    timezones.put("America/Los_Angeles", tz);
6f1b0c
-    timezones.put("America/Tijuana", tz);
6f1b0c
-    timezones.put("America/Vancouver", tz);
6f1b0c
-    timezones.put("America/Whitehorse", tz);
6f1b0c
-    timezones.put("US/Pacific-New", tz);
6f1b0c
-    tz = new SimpleTimeZone(-8000 * 3600, "Pacific/Pitcairn");
6f1b0c
-    timezones.put("Pacific/Pitcairn", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-7000 * 3600, "MST",
6f1b0c
-       Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("MST", tz);
6f1b0c
-    timezones.put("MST7MDT", tz);
6f1b0c
-    timezones.put("America/Boise", tz);
6f1b0c
-    timezones.put("America/Chihuahua", tz);
6f1b0c
-    timezones.put("America/Denver", tz);
6f1b0c
-    timezones.put("America/Edmonton", tz);
6f1b0c
-    timezones.put("America/Inuvik", tz);
6f1b0c
-    timezones.put("America/Mazatlan", tz);
6f1b0c
-    timezones.put("America/Shiprock", tz);
6f1b0c
-    timezones.put("America/Yellowknife", tz);
6f1b0c
-    tz = new SimpleTimeZone(-7000 * 3600, "MST7");
6f1b0c
-    timezones.put("MST7", tz);
6f1b0c
-    timezones.put("PNT", tz);
6f1b0c
-    timezones.put("America/Dawson_Creek", tz);
6f1b0c
-    timezones.put("America/Hermosillo", tz);
6f1b0c
-    timezones.put("America/Phoenix", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-6000 * 3600, "CST",
6f1b0c
-       Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("CST", tz);
6f1b0c
-    timezones.put("CST6CDT", tz);
6f1b0c
-    timezones.put("America/Cambridge_Bay", tz);
6f1b0c
-    timezones.put("America/Cancun", tz);
6f1b0c
-    timezones.put("America/Chicago", tz);
6f1b0c
-    timezones.put("America/Menominee", tz);
6f1b0c
-    timezones.put("America/Merida", tz);
6f1b0c
-    timezones.put("America/Mexico_City", tz);
6f1b0c
-    timezones.put("America/Monterrey", tz);
6f1b0c
-    timezones.put("America/Rainy_River", tz);
6f1b0c
-    timezones.put("America/Winnipeg", tz);
6f1b0c
-    tz = new SimpleTimeZone(-6000 * 3600, "America/Belize");
6f1b0c
-    timezones.put("America/Belize", tz);
6f1b0c
-    timezones.put("America/Costa_Rica", tz);
6f1b0c
-    timezones.put("America/El_Salvador", tz);
6f1b0c
-    timezones.put("America/Guatemala", tz);
6f1b0c
-    timezones.put("America/Managua", tz);
6f1b0c
-    timezones.put("America/Regina", tz);
6f1b0c
-    timezones.put("America/Swift_Current", tz);
6f1b0c
-    timezones.put("America/Tegucigalpa", tz);
6f1b0c
-    timezones.put("Pacific/Galapagos", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-6000 * 3600, "Pacific/Easter",
6f1b0c
-       Calendar.OCTOBER, 9, -Calendar.SUNDAY, 0 * 3600,
6f1b0c
-       Calendar.MARCH, 9, -Calendar.SUNDAY, 0 * 3600);
6f1b0c
-    timezones.put("Pacific/Easter", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-5000 * 3600, "America/Grand_Turk",
6f1b0c
-       Calendar.APRIL, 1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
6f1b0c
-    timezones.put("America/Grand_Turk", tz);
6f1b0c
-    timezones.put("America/Havana", tz);
6f1b0c
-    tz = new SimpleTimeZone(-5000 * 3600, "EST5");
6f1b0c
-    timezones.put("EST5", tz);
6f1b0c
-    timezones.put("IET", tz);
6f1b0c
-    timezones.put("America/Bogota", tz);
6f1b0c
-    timezones.put("America/Cayman", tz);
6f1b0c
-    timezones.put("America/Eirunepe", tz);
6f1b0c
-    timezones.put("America/Guayaquil", tz);
6f1b0c
-    timezones.put("America/Indiana/Indianapolis", tz);
6f1b0c
-    timezones.put("America/Indiana/Knox", tz);
6f1b0c
-    timezones.put("America/Indiana/Marengo", tz);
6f1b0c
-    timezones.put("America/Indiana/Vevay", tz);
6f1b0c
-    timezones.put("America/Indianapolis", tz);
6f1b0c
-    timezones.put("America/Iqaluit", tz);
6f1b0c
-    timezones.put("America/Jamaica", tz);
6f1b0c
-    timezones.put("America/Lima", tz);
6f1b0c
-    timezones.put("America/Panama", tz);
6f1b0c
-    timezones.put("America/Pangnirtung", tz);
6f1b0c
-    timezones.put("America/Port-au-Prince", tz);
6f1b0c
-    timezones.put("America/Porto_Acre", tz);
6f1b0c
-    timezones.put("America/Rankin_Inlet", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-5000 * 3600, "EST",
6f1b0c
-       Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("EST", tz);
6f1b0c
-    timezones.put("EST5EDT", tz);
6f1b0c
-    timezones.put("America/Detroit", tz);
6f1b0c
-    timezones.put("America/Kentucky/Louisville", tz);
6f1b0c
-    timezones.put("America/Kentucky/Monticello", tz);
6f1b0c
-    timezones.put("America/Louisville", tz);
6f1b0c
-    timezones.put("America/Montreal", tz);
6f1b0c
-    timezones.put("America/Nassau", tz);
6f1b0c
-    timezones.put("America/New_York", tz);
6f1b0c
-    timezones.put("America/Nipigon", tz);
6f1b0c
-    timezones.put("America/Thunder_Bay", tz);
6f1b0c
-    tz = new SimpleTimeZone(-4000 * 3600, "PRT");
6f1b0c
-    timezones.put("PRT", tz);
6f1b0c
-    timezones.put("America/Anguilla", tz);
6f1b0c
-    timezones.put("America/Antigua", tz);
6f1b0c
-    timezones.put("America/Aruba", tz);
6f1b0c
-    timezones.put("America/Barbados", tz);
6f1b0c
-    timezones.put("America/Boa_Vista", tz);
6f1b0c
-    timezones.put("America/Caracas", tz);
6f1b0c
-    timezones.put("America/Curacao", tz);
6f1b0c
-    timezones.put("America/Dominica", tz);
6f1b0c
-    timezones.put("America/Grenada", tz);
6f1b0c
-    timezones.put("America/Guadeloupe", tz);
6f1b0c
-    timezones.put("America/Guyana", tz);
6f1b0c
-    timezones.put("America/La_Paz", tz);
6f1b0c
-    timezones.put("America/Manaus", tz);
6f1b0c
-    timezones.put("America/Martinique", tz);
6f1b0c
-    timezones.put("America/Montserrat", tz);
6f1b0c
-    timezones.put("America/Port_of_Spain", tz);
6f1b0c
-    timezones.put("America/Porto_Velho", tz);
6f1b0c
-    timezones.put("America/Puerto_Rico", tz);
6f1b0c
-    timezones.put("America/Santo_Domingo", tz);
6f1b0c
-    timezones.put("America/St_Kitts", tz);
6f1b0c
-    timezones.put("America/St_Lucia", tz);
6f1b0c
-    timezones.put("America/St_Thomas", tz);
6f1b0c
-    timezones.put("America/St_Vincent", tz);
6f1b0c
-    timezones.put("America/Tortola", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-4000 * 3600, "America/Asuncion",
6f1b0c
-       Calendar.OCTOBER, 1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
-       Calendar.FEBRUARY, -1, Calendar.SUNDAY, 0 * 3600);
6f1b0c
-    timezones.put("America/Asuncion", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-4000 * 3600, "America/Cuiaba",
6f1b0c
-       Calendar.OCTOBER, 2, Calendar.SUNDAY, 0 * 3600,
6f1b0c
-       Calendar.FEBRUARY, 3, Calendar.SUNDAY, 0 * 3600);
6f1b0c
-    timezones.put("America/Cuiaba", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-4000 * 3600, "America/Goose_Bay",
6f1b0c
-       Calendar.APRIL, 1, Calendar.SUNDAY, 60000,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 60000);
6f1b0c
-    timezones.put("America/Goose_Bay", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-4000 * 3600, "America/Glace_Bay",
6f1b0c
-       Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("America/Glace_Bay", tz);
6f1b0c
-    timezones.put("America/Halifax", tz);
6f1b0c
-    timezones.put("America/Thule", tz);
6f1b0c
-    timezones.put("Atlantic/Bermuda", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-4000 * 3600, "America/Santiago",
6f1b0c
-       Calendar.OCTOBER, 9, -Calendar.SUNDAY, 0 * 3600,
6f1b0c
-       Calendar.MARCH, 9, -Calendar.SUNDAY, 0 * 3600);
6f1b0c
-    timezones.put("America/Santiago", tz);
6f1b0c
-    timezones.put("Antarctica/Palmer", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-4000 * 3600, "Atlantic/Stanley",
6f1b0c
-       Calendar.SEPTEMBER, 2, Calendar.SUNDAY, 0 * 3600,
6f1b0c
-       Calendar.APRIL, 16, -Calendar.SUNDAY, 0 * 3600);
6f1b0c
-    timezones.put("Atlantic/Stanley", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-3500 * 3600, "CNT",
6f1b0c
-       Calendar.APRIL, 1, Calendar.SUNDAY, 60000,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 60000);
6f1b0c
-    timezones.put("CNT", tz);
6f1b0c
-    timezones.put("America/St_Johns", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-3000 * 3600, "America/Araguaina",
6f1b0c
-       Calendar.OCTOBER, 2, Calendar.SUNDAY, 0 * 3600,
6f1b0c
-       Calendar.FEBRUARY, 3, Calendar.SUNDAY, 0 * 3600);
6f1b0c
-    timezones.put("America/Araguaina", tz);
6f1b0c
-    timezones.put("America/Sao_Paulo", tz);
6f1b0c
-    tz = new SimpleTimeZone(-3000 * 3600, "AGT");
6f1b0c
-    timezones.put("AGT", tz);
6f1b0c
-    timezones.put("America/Belem", tz);
6f1b0c
-    timezones.put("America/Buenos_Aires", tz);
6f1b0c
-    timezones.put("America/Catamarca", tz);
6f1b0c
-    timezones.put("America/Cayenne", tz);
6f1b0c
-    timezones.put("America/Cordoba", tz);
6f1b0c
-    timezones.put("America/Fortaleza", tz);
6f1b0c
-    timezones.put("America/Jujuy", tz);
6f1b0c
-    timezones.put("America/Maceio", tz);
6f1b0c
-    timezones.put("America/Mendoza", tz);
6f1b0c
-    timezones.put("America/Montevideo", tz);
6f1b0c
-    timezones.put("America/Paramaribo", tz);
6f1b0c
-    timezones.put("America/Recife", tz);
6f1b0c
-    timezones.put("America/Rosario", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-3000 * 3600, "America/Godthab",
6f1b0c
-       Calendar.MARCH, 30, -Calendar.SATURDAY, 22000 * 3600,
6f1b0c
-       Calendar.OCTOBER, 30, -Calendar.SATURDAY, 22000 * 3600);
6f1b0c
-    timezones.put("America/Godthab", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-3000 * 3600, "America/Miquelon",
6f1b0c
-       Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("America/Miquelon", tz);
6f1b0c
-    tz = new SimpleTimeZone(-2000 * 3600, "America/Noronha");
6f1b0c
-    timezones.put("America/Noronha", tz);
6f1b0c
-    timezones.put("Atlantic/South_Georgia", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (-1000 * 3600, "America/Scoresbysund",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
6f1b0c
-    timezones.put("America/Scoresbysund", tz);
6f1b0c
-    timezones.put("Atlantic/Azores", tz);
6f1b0c
-    tz = new SimpleTimeZone(-1000 * 3600, "Atlantic/Cape_Verde");
6f1b0c
-    timezones.put("Atlantic/Cape_Verde", tz);
6f1b0c
-    timezones.put("Atlantic/Jan_Mayen", tz);
6f1b0c
-    tz = new SimpleTimeZone(0 * 3600, "GMT");
6f1b0c
-    timezones.put("GMT", tz);
6f1b0c
-    timezones.put("UTC", tz);
6f1b0c
-    timezones.put("Africa/Abidjan", tz);
6f1b0c
-    timezones.put("Africa/Accra", tz);
6f1b0c
-    timezones.put("Africa/Bamako", tz);
6f1b0c
-    timezones.put("Africa/Banjul", tz);
6f1b0c
-    timezones.put("Africa/Bissau", tz);
6f1b0c
-    timezones.put("Africa/Casablanca", tz);
6f1b0c
-    timezones.put("Africa/Conakry", tz);
6f1b0c
-    timezones.put("Africa/Dakar", tz);
6f1b0c
-    timezones.put("Africa/El_Aaiun", tz);
6f1b0c
-    timezones.put("Africa/Freetown", tz);
6f1b0c
-    timezones.put("Africa/Lome", tz);
6f1b0c
-    timezones.put("Africa/Monrovia", tz);
6f1b0c
-    timezones.put("Africa/Nouakchott", tz);
6f1b0c
-    timezones.put("Africa/Ouagadougou", tz);
6f1b0c
-    timezones.put("Africa/Sao_Tome", tz);
6f1b0c
-    timezones.put("Africa/Timbuktu", tz);
6f1b0c
-    timezones.put("Atlantic/Reykjavik", tz);
6f1b0c
-    timezones.put("Atlantic/St_Helena", tz);
6f1b0c
-    timezones.put("Europe/Belfast", tz);
6f1b0c
-    timezones.put("Europe/Dublin", tz);
6f1b0c
-    timezones.put("Europe/London", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (0 * 3600, "WET",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 1000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
6f1b0c
-    timezones.put("WET", tz);
6f1b0c
-    timezones.put("Atlantic/Canary", tz);
6f1b0c
-    timezones.put("Atlantic/Faeroe", tz);
6f1b0c
-    timezones.put("Atlantic/Madeira", tz);
6f1b0c
-    timezones.put("Europe/Lisbon", tz);
6f1b0c
-    tz = new SimpleTimeZone(1000 * 3600, "Africa/Algiers");
6f1b0c
-    timezones.put("Africa/Algiers", tz);
6f1b0c
-    timezones.put("Africa/Bangui", tz);
6f1b0c
-    timezones.put("Africa/Brazzaville", tz);
6f1b0c
-    timezones.put("Africa/Douala", tz);
6f1b0c
-    timezones.put("Africa/Kinshasa", tz);
6f1b0c
-    timezones.put("Africa/Lagos", tz);
6f1b0c
-    timezones.put("Africa/Libreville", tz);
6f1b0c
-    timezones.put("Africa/Luanda", tz);
6f1b0c
-    timezones.put("Africa/Malabo", tz);
6f1b0c
-    timezones.put("Africa/Ndjamena", tz);
6f1b0c
-    timezones.put("Africa/Niamey", tz);
6f1b0c
-    timezones.put("Africa/Porto-Novo", tz);
6f1b0c
-    timezones.put("Africa/Tunis", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (1000 * 3600, "Africa/Windhoek",
6f1b0c
-       Calendar.SEPTEMBER, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Africa/Windhoek", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (1000 * 3600, "CET",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("CET", tz);
6f1b0c
-    timezones.put("ECT", tz);
6f1b0c
-    timezones.put("MET", tz);
6f1b0c
-    timezones.put("Africa/Ceuta", tz);
6f1b0c
-    timezones.put("Arctic/Longyearbyen", tz);
6f1b0c
-    timezones.put("Europe/Amsterdam", tz);
6f1b0c
-    timezones.put("Europe/Andorra", tz);
6f1b0c
-    timezones.put("Europe/Belgrade", tz);
6f1b0c
-    timezones.put("Europe/Berlin", tz);
6f1b0c
-    timezones.put("Europe/Bratislava", tz);
6f1b0c
-    timezones.put("Europe/Brussels", tz);
6f1b0c
-    timezones.put("Europe/Budapest", tz);
6f1b0c
-    timezones.put("Europe/Copenhagen", tz);
6f1b0c
-    timezones.put("Europe/Gibraltar", tz);
6f1b0c
-    timezones.put("Europe/Ljubljana", tz);
6f1b0c
-    timezones.put("Europe/Luxembourg", tz);
6f1b0c
-    timezones.put("Europe/Madrid", tz);
6f1b0c
-    timezones.put("Europe/Malta", tz);
6f1b0c
-    timezones.put("Europe/Monaco", tz);
6f1b0c
-    timezones.put("Europe/Oslo", tz);
6f1b0c
-    timezones.put("Europe/Paris", tz);
6f1b0c
-    timezones.put("Europe/Prague", tz);
6f1b0c
-    timezones.put("Europe/Rome", tz);
6f1b0c
-    timezones.put("Europe/San_Marino", tz);
6f1b0c
-    timezones.put("Europe/Sarajevo", tz);
6f1b0c
-    timezones.put("Europe/Skopje", tz);
6f1b0c
-    timezones.put("Europe/Stockholm", tz);
6f1b0c
-    timezones.put("Europe/Tirane", tz);
6f1b0c
-    timezones.put("Europe/Vaduz", tz);
6f1b0c
-    timezones.put("Europe/Vatican", tz);
6f1b0c
-    timezones.put("Europe/Vienna", tz);
6f1b0c
-    timezones.put("Europe/Warsaw", tz);
6f1b0c
-    timezones.put("Europe/Zagreb", tz);
6f1b0c
-    timezones.put("Europe/Zurich", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (2000 * 3600, "ART",
6f1b0c
-       Calendar.APRIL, -1, Calendar.FRIDAY, 0 * 3600,
6f1b0c
-       Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 23000 * 3600);
6f1b0c
-    timezones.put("ART", tz);
6f1b0c
-    timezones.put("Africa/Cairo", tz);
6f1b0c
-    tz = new SimpleTimeZone(2000 * 3600, "CAT");
6f1b0c
-    timezones.put("CAT", tz);
6f1b0c
-    timezones.put("Africa/Blantyre", tz);
6f1b0c
-    timezones.put("Africa/Bujumbura", tz);
6f1b0c
-    timezones.put("Africa/Gaborone", tz);
6f1b0c
-    timezones.put("Africa/Harare", tz);
6f1b0c
-    timezones.put("Africa/Johannesburg", tz);
6f1b0c
-    timezones.put("Africa/Kigali", tz);
6f1b0c
-    timezones.put("Africa/Lubumbashi", tz);
6f1b0c
-    timezones.put("Africa/Lusaka", tz);
6f1b0c
-    timezones.put("Africa/Maputo", tz);
6f1b0c
-    timezones.put("Africa/Maseru", tz);
6f1b0c
-    timezones.put("Africa/Mbabane", tz);
6f1b0c
-    timezones.put("Africa/Tripoli", tz);
6f1b0c
-    timezones.put("Europe/Riga", tz);
6f1b0c
-    timezones.put("Europe/Tallinn", tz);
6f1b0c
-    timezones.put("Europe/Vilnius", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (2000 * 3600, "Asia/Amman",
6f1b0c
-       Calendar.MARCH, -1, Calendar.THURSDAY, 0 * 3600,
6f1b0c
-       Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 0 * 3600);
6f1b0c
-    timezones.put("Asia/Amman", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (2000 * 3600, "Asia/Beirut",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
6f1b0c
-    timezones.put("Asia/Beirut", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (2000 * 3600, "Asia/Damascus",
6f1b0c
-       Calendar.APRIL, 1, 0, 0 * 3600,
6f1b0c
-       Calendar.OCTOBER, 1, 0, 0 * 3600);
6f1b0c
-    timezones.put("Asia/Damascus", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (2000 * 3600, "Asia/Gaza",
6f1b0c
-       Calendar.APRIL, 3, Calendar.FRIDAY, 0 * 3600,
6f1b0c
-       Calendar.OCTOBER, 3, Calendar.FRIDAY, 0 * 3600);
6f1b0c
-    timezones.put("Asia/Gaza", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (2000 * 3600, "Asia/Jerusalem",
6f1b0c
-       Calendar.APRIL, 1, 0, 1000 * 3600,
6f1b0c
-       Calendar.OCTOBER, 1, 0, 1000 * 3600);
6f1b0c
-    timezones.put("Asia/Jerusalem", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (2000 * 3600, "EET",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
-    timezones.put("EET", tz);
6f1b0c
-    timezones.put("Asia/Istanbul", tz);
6f1b0c
-    timezones.put("Asia/Nicosia", tz);
6f1b0c
-    timezones.put("Europe/Athens", tz);
6f1b0c
-    timezones.put("Europe/Bucharest", tz);
6f1b0c
-    timezones.put("Europe/Chisinau", tz);
6f1b0c
-    timezones.put("Europe/Helsinki", tz);
6f1b0c
-    timezones.put("Europe/Istanbul", tz);
6f1b0c
-    timezones.put("Europe/Kiev", tz);
6f1b0c
-    timezones.put("Europe/Nicosia", tz);
6f1b0c
-    timezones.put("Europe/Simferopol", tz);
6f1b0c
-    timezones.put("Europe/Sofia", tz);
6f1b0c
-    timezones.put("Europe/Uzhgorod", tz);
6f1b0c
-    timezones.put("Europe/Zaporozhye", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (2000 * 3600, "Europe/Kaliningrad",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Europe/Kaliningrad", tz);
6f1b0c
-    timezones.put("Europe/Minsk", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (3000 * 3600, "Asia/Baghdad",
6f1b0c
-       Calendar.APRIL, 1, 0, 3000 * 3600,
6f1b0c
-       Calendar.OCTOBER, 1, 0, 3000 * 3600);
6f1b0c
-    timezones.put("Asia/Baghdad", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (3000 * 3600, "Europe/Moscow",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Europe/Moscow", tz);
6f1b0c
-    timezones.put("Europe/Tiraspol", tz);
6f1b0c
-    tz = new SimpleTimeZone(3000 * 3600, "EAT");
6f1b0c
-    timezones.put("EAT", tz);
6f1b0c
-    timezones.put("Africa/Addis_Ababa", tz);
6f1b0c
-    timezones.put("Africa/Asmera", tz);
6f1b0c
-    timezones.put("Africa/Dar_es_Salaam", tz);
6f1b0c
-    timezones.put("Africa/Djibouti", tz);
6f1b0c
-    timezones.put("Africa/Kampala", tz);
6f1b0c
-    timezones.put("Africa/Khartoum", tz);
6f1b0c
-    timezones.put("Africa/Mogadishu", tz);
6f1b0c
-    timezones.put("Africa/Nairobi", tz);
6f1b0c
-    timezones.put("Antarctica/Syowa", tz);
6f1b0c
-    timezones.put("Asia/Aden", tz);
6f1b0c
-    timezones.put("Asia/Bahrain", tz);
6f1b0c
-    timezones.put("Asia/Kuwait", tz);
6f1b0c
-    timezones.put("Asia/Qatar", tz);
6f1b0c
-    timezones.put("Asia/Riyadh", tz);
6f1b0c
-    timezones.put("Indian/Antananarivo", tz);
6f1b0c
-    timezones.put("Indian/Comoro", tz);
6f1b0c
-    timezones.put("Indian/Mayotte", tz);
6f1b0c
-    tz = new SimpleTimeZone(3500 * 3600, "Asia/Tehran");
6f1b0c
-    timezones.put("Asia/Tehran", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (4000 * 3600, "Asia/Baku",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 1000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
6f1b0c
-    timezones.put("Asia/Baku", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (4000 * 3600, "Asia/Aqtau",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
6f1b0c
-    timezones.put("Asia/Aqtau", tz);
6f1b0c
-    timezones.put("Asia/Tbilisi", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (4000 * 3600, "Asia/Yerevan",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Asia/Yerevan", tz);
6f1b0c
-    timezones.put("Europe/Samara", tz);
6f1b0c
-    tz = new SimpleTimeZone(4000 * 3600, "NET");
6f1b0c
-    timezones.put("NET", tz);
6f1b0c
-    timezones.put("Asia/Dubai", tz);
6f1b0c
-    timezones.put("Asia/Muscat", tz);
6f1b0c
-    timezones.put("Indian/Mahe", tz);
6f1b0c
-    timezones.put("Indian/Mauritius", tz);
6f1b0c
-    timezones.put("Indian/Reunion", tz);
6f1b0c
-    tz = new SimpleTimeZone(4500 * 3600, "Asia/Kabul");
6f1b0c
-    timezones.put("Asia/Kabul", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (5000 * 3600, "Asia/Aqtobe",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
6f1b0c
-    timezones.put("Asia/Aqtobe", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (5000 * 3600, "Asia/Bishkek",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2500 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2500 * 3600);
6f1b0c
-    timezones.put("Asia/Bishkek", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (5000 * 3600, "Asia/Yekaterinburg",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Asia/Yekaterinburg", tz);
6f1b0c
-    tz = new SimpleTimeZone(5000 * 3600, "PLT");
6f1b0c
-    timezones.put("PLT", tz);
6f1b0c
-    timezones.put("Asia/Ashgabat", tz);
6f1b0c
-    timezones.put("Asia/Dushanbe", tz);
6f1b0c
-    timezones.put("Asia/Karachi", tz);
6f1b0c
-    timezones.put("Asia/Samarkand", tz);
6f1b0c
-    timezones.put("Asia/Tashkent", tz);
6f1b0c
-    timezones.put("Indian/Chagos", tz);
6f1b0c
-    timezones.put("Indian/Kerguelen", tz);
6f1b0c
-    timezones.put("Indian/Maldives", tz);
6f1b0c
-    tz = new SimpleTimeZone(5500 * 3600, "IST");
6f1b0c
-    timezones.put("IST", tz);
6f1b0c
-    timezones.put("Asia/Calcutta", tz);
6f1b0c
-    tz = new SimpleTimeZone(5750 * 3600, "Asia/Katmandu");
6f1b0c
-    timezones.put("Asia/Katmandu", tz);
6f1b0c
-    tz = new SimpleTimeZone(6000 * 3600, "BST");
6f1b0c
-    timezones.put("BST", tz);
6f1b0c
-    timezones.put("Antarctica/Mawson", tz);
6f1b0c
-    timezones.put("Asia/Colombo", tz);
6f1b0c
-    timezones.put("Asia/Dhaka", tz);
6f1b0c
-    timezones.put("Asia/Thimphu", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (6000 * 3600, "Asia/Almaty",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
6f1b0c
-    timezones.put("Asia/Almaty", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (6000 * 3600, "Asia/Novosibirsk",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Asia/Novosibirsk", tz);
6f1b0c
-    timezones.put("Asia/Omsk", tz);
6f1b0c
-    tz = new SimpleTimeZone(6500 * 3600, "Asia/Rangoon");
6f1b0c
-    timezones.put("Asia/Rangoon", tz);
6f1b0c
-    timezones.put("Indian/Cocos", tz);
6f1b0c
-    tz = new SimpleTimeZone(7000 * 3600, "VST");
6f1b0c
-    timezones.put("VST", tz);
6f1b0c
-    timezones.put("Antarctica/Davis", tz);
6f1b0c
-    timezones.put("Asia/Bangkok", tz);
6f1b0c
-    timezones.put("Asia/Hovd", tz);
6f1b0c
-    timezones.put("Asia/Jakarta", tz);
6f1b0c
-    timezones.put("Asia/Phnom_Penh", tz);
6f1b0c
-    timezones.put("Asia/Saigon", tz);
6f1b0c
-    timezones.put("Asia/Vientiane", tz);
6f1b0c
-    timezones.put("Indian/Christmas", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (7000 * 3600, "Asia/Krasnoyarsk",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Asia/Krasnoyarsk", tz);
6f1b0c
-    tz = new SimpleTimeZone(8000 * 3600, "CTT");
6f1b0c
-    timezones.put("CTT", tz);
6f1b0c
-    timezones.put("Antarctica/Casey", tz);
6f1b0c
-    timezones.put("Asia/Brunei", tz);
6f1b0c
-    timezones.put("Asia/Chungking", tz);
6f1b0c
-    timezones.put("Asia/Harbin", tz);
6f1b0c
-    timezones.put("Asia/Hong_Kong", tz);
6f1b0c
-    timezones.put("Asia/Kashgar", tz);
6f1b0c
-    timezones.put("Asia/Kuala_Lumpur", tz);
6f1b0c
-    timezones.put("Asia/Kuching", tz);
6f1b0c
-    timezones.put("Asia/Macao", tz);
6f1b0c
-    timezones.put("Asia/Manila", tz);
6f1b0c
-    timezones.put("Asia/Shanghai", tz);
6f1b0c
-    timezones.put("Asia/Singapore", tz);
6f1b0c
-    timezones.put("Asia/Taipei", tz);
6f1b0c
-    timezones.put("Asia/Ujung_Pandang", tz);
6f1b0c
-    timezones.put("Asia/Ulaanbaatar", tz);
6f1b0c
-    timezones.put("Asia/Urumqi", tz);
6f1b0c
-    timezones.put("Australia/Perth", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (8000 * 3600, "Asia/Irkutsk",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Asia/Irkutsk", tz);
6f1b0c
-    tz = new SimpleTimeZone(9000 * 3600, "JST");
6f1b0c
-    timezones.put("JST", tz);
6f1b0c
-    timezones.put("Asia/Dili", tz);
6f1b0c
-    timezones.put("Asia/Jayapura", tz);
6f1b0c
-    timezones.put("Asia/Pyongyang", tz);
6f1b0c
-    timezones.put("Asia/Seoul", tz);
6f1b0c
-    timezones.put("Asia/Tokyo", tz);
6f1b0c
-    timezones.put("Pacific/Palau", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (9000 * 3600, "Asia/Yakutsk",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Asia/Yakutsk", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (9500 * 3600, "Australia/Adelaide",
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Australia/Adelaide", tz);
6f1b0c
-    timezones.put("Australia/Broken_Hill", tz);
6f1b0c
-    tz = new SimpleTimeZone(9500 * 3600, "ACT");
6f1b0c
-    timezones.put("ACT", tz);
6f1b0c
-    timezones.put("Australia/Darwin", tz);
6f1b0c
-    tz = new SimpleTimeZone(10000 * 3600, "Antarctica/DumontDUrville");
6f1b0c
-    timezones.put("Antarctica/DumontDUrville", tz);
6f1b0c
-    timezones.put("Australia/Brisbane", tz);
6f1b0c
-    timezones.put("Australia/Lindeman", tz);
6f1b0c
-    timezones.put("Pacific/Guam", tz);
6f1b0c
-    timezones.put("Pacific/Port_Moresby", tz);
6f1b0c
-    timezones.put("Pacific/Saipan", tz);
6f1b0c
-    timezones.put("Pacific/Truk", tz);
6f1b0c
-    timezones.put("Pacific/Yap", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (10000 * 3600, "Asia/Vladivostok",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Asia/Vladivostok", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (10000 * 3600, "Australia/Hobart",
6f1b0c
-       Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Australia/Hobart", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (10000 * 3600, "AET",
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("AET", tz);
6f1b0c
-    timezones.put("Australia/Melbourne", tz);
6f1b0c
-    timezones.put("Australia/Sydney", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (10500 * 3600, "Australia/Lord_Howe",
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600, 500 * 3600);
6f1b0c
-    timezones.put("Australia/Lord_Howe", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (11000 * 3600, "Asia/Magadan",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Asia/Magadan", tz);
6f1b0c
-    tz = new SimpleTimeZone(11000 * 3600, "SST");
6f1b0c
-    timezones.put("SST", tz);
6f1b0c
-    timezones.put("Pacific/Efate", tz);
6f1b0c
-    timezones.put("Pacific/Guadalcanal", tz);
6f1b0c
-    timezones.put("Pacific/Kosrae", tz);
6f1b0c
-    timezones.put("Pacific/Noumea", tz);
6f1b0c
-    timezones.put("Pacific/Ponape", tz);
6f1b0c
-    tz = new SimpleTimeZone(11500 * 3600, "Pacific/Norfolk");
6f1b0c
-    timezones.put("Pacific/Norfolk", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (12000 * 3600, "NST",
6f1b0c
-       Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.MARCH, 3, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("NST", tz);
6f1b0c
-    timezones.put("Antarctica/McMurdo", tz);
6f1b0c
-    timezones.put("Antarctica/South_Pole", tz);
6f1b0c
-    timezones.put("Pacific/Auckland", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (12000 * 3600, "Asia/Anadyr",
6f1b0c
-       Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
-       Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
-    timezones.put("Asia/Anadyr", tz);
6f1b0c
-    timezones.put("Asia/Kamchatka", tz);
6f1b0c
-    tz = new SimpleTimeZone(12000 * 3600, "Pacific/Fiji");
6f1b0c
-    timezones.put("Pacific/Fiji", tz);
6f1b0c
-    timezones.put("Pacific/Funafuti", tz);
6f1b0c
-    timezones.put("Pacific/Kwajalein", tz);
6f1b0c
-    timezones.put("Pacific/Majuro", tz);
6f1b0c
-    timezones.put("Pacific/Nauru", tz);
6f1b0c
-    timezones.put("Pacific/Tarawa", tz);
6f1b0c
-    timezones.put("Pacific/Wake", tz);
6f1b0c
-    timezones.put("Pacific/Wallis", tz);
6f1b0c
-    tz = new SimpleTimeZone
6f1b0c
-      (12750 * 3600, "Pacific/Chatham",
6f1b0c
-       Calendar.OCTOBER, 1, Calendar.SUNDAY, 2750 * 3600,
6f1b0c
-       Calendar.MARCH, 3, Calendar.SUNDAY, 2750 * 3600);
6f1b0c
-    timezones.put("Pacific/Chatham", tz);
6f1b0c
-    tz = new SimpleTimeZone(13000 * 3600, "Pacific/Enderbury");
6f1b0c
-    timezones.put("Pacific/Enderbury", tz);
6f1b0c
-    timezones.put("Pacific/Tongatapu", tz);
6f1b0c
-    tz = new SimpleTimeZone(14000 * 3600, "Pacific/Kiritimati");
6f1b0c
-    timezones.put("Pacific/Kiritimati", tz);
6f1b0c
+  /**
6f1b0c
+   * Cached copy of getAvailableIDs().
6f1b0c
+   */
6f1b0c
+  private static String[] availableIDs = null;
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * JDK 1.1.x compatibility aliases.
6f1b0c
+   */
6f1b0c
+  private static Hashtable aliases0;
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Hashtable for timezones by ID.
6f1b0c
+   */
6f1b0c
+  private static Hashtable timezones0;
6f1b0c
+  /* initialize this static field lazily to overhead if
6f1b0c
+   * it is not needed: 
6f1b0c
+   */
6f1b0c
+  private static Hashtable timezones() {
6f1b0c
+    if (timezones0==null) 
6f1b0c
+      {
6f1b0c
+	Hashtable timezones = new Hashtable();
6f1b0c
+	timezones0 = timezones;
6f1b0c
+
6f1b0c
+	zoneinfo_dir = System.getProperty("gnu.java.util.zoneinfo.dir");
6f1b0c
+	if (zoneinfo_dir != null && !new File(zoneinfo_dir).isDirectory())
6f1b0c
+	  zoneinfo_dir = null;
6f1b0c
+
6f1b0c
+	if (zoneinfo_dir != null)
6f1b0c
+	  {
6f1b0c
+	    aliases0 = new Hashtable();
6f1b0c
+
6f1b0c
+	    // These deprecated aliases for JDK 1.1.x compatibility
6f1b0c
+	    // should take precedence over data files read from
6f1b0c
+	    // /usr/share/zoneinfo.
6f1b0c
+	    aliases0.put("ACT", "Australia/Darwin");
6f1b0c
+	    aliases0.put("AET", "Australia/Sydney");
6f1b0c
+	    aliases0.put("AGT", "America/Argentina/Buenos_Aires");
6f1b0c
+	    aliases0.put("ART", "Africa/Cairo");
6f1b0c
+	    aliases0.put("AST", "America/Juneau");
6f1b0c
+	    aliases0.put("BST", "Asia/Colombo");
6f1b0c
+	    aliases0.put("CAT", "Africa/Gaborone");
6f1b0c
+	    aliases0.put("CNT", "America/St_Johns");
6f1b0c
+	    aliases0.put("CST", "CST6CDT");
6f1b0c
+	    aliases0.put("CTT", "Asia/Brunei");
6f1b0c
+	    aliases0.put("EAT", "Indian/Comoro");
6f1b0c
+	    aliases0.put("ECT", "CET");
6f1b0c
+	    aliases0.put("EST", "EST5EDT");
6f1b0c
+	    aliases0.put("EST5", "EST5EDT");
6f1b0c
+	    aliases0.put("IET", "EST5EDT");
6f1b0c
+	    aliases0.put("IST", "Asia/Calcutta");
6f1b0c
+	    aliases0.put("JST", "Asia/Seoul");
6f1b0c
+	    aliases0.put("MIT", "Pacific/Niue");
6f1b0c
+	    aliases0.put("MST", "MST7MDT");
6f1b0c
+	    aliases0.put("MST7", "MST7MDT");
6f1b0c
+	    aliases0.put("NET", "Indian/Mauritius");
6f1b0c
+	    aliases0.put("NST", "Pacific/Auckland");
6f1b0c
+	    aliases0.put("PLT", "Indian/Kerguelen");
6f1b0c
+	    aliases0.put("PNT", "MST7MDT");
6f1b0c
+	    aliases0.put("PRT", "America/Anguilla");
6f1b0c
+	    aliases0.put("PST", "PST8PDT");
6f1b0c
+	    aliases0.put("SST", "Pacific/Ponape");
6f1b0c
+	    aliases0.put("VST", "Asia/Bangkok");
6f1b0c
+	    return timezones;
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	TimeZone tz;
6f1b0c
+	// Automatically generated by scripts/timezones.pl
6f1b0c
+	// XXX - Should we read this data from a file?
6f1b0c
+	tz = new SimpleTimeZone(-11000 * 3600, "MIT");
6f1b0c
+	timezones0.put("MIT", tz);
6f1b0c
+	timezones0.put("Pacific/Apia", tz);
6f1b0c
+	timezones0.put("Pacific/Midway", tz);
6f1b0c
+	timezones0.put("Pacific/Niue", tz);
6f1b0c
+	timezones0.put("Pacific/Pago_Pago", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-10000 * 3600, "America/Adak",
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("America/Adak", tz);
6f1b0c
+	tz = new SimpleTimeZone(-10000 * 3600, "HST");
6f1b0c
+	timezones0.put("HST", tz);
6f1b0c
+	timezones0.put("Pacific/Fakaofo", tz);
6f1b0c
+	timezones0.put("Pacific/Honolulu", tz);
6f1b0c
+	timezones0.put("Pacific/Johnston", tz);
6f1b0c
+	timezones0.put("Pacific/Rarotonga", tz);
6f1b0c
+	timezones0.put("Pacific/Tahiti", tz);
6f1b0c
+	tz = new SimpleTimeZone(-9500 * 3600, "Pacific/Marquesas");
6f1b0c
+	timezones0.put("Pacific/Marquesas", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-9000 * 3600, "AST",
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("AST", tz);
6f1b0c
+	timezones0.put("America/Anchorage", tz);
6f1b0c
+	timezones0.put("America/Juneau", tz);
6f1b0c
+	timezones0.put("America/Nome", tz);
6f1b0c
+	timezones0.put("America/Yakutat", tz);
6f1b0c
+	tz = new SimpleTimeZone(-9000 * 3600, "Pacific/Gambier");
6f1b0c
+	timezones0.put("Pacific/Gambier", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-8000 * 3600, "America/Tijuana",
6f1b0c
+	   Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("America/Tijuana", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-8000 * 3600, "PST",
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("PST", tz);
6f1b0c
+	timezones0.put("PST8PDT", tz);
6f1b0c
+	timezones0.put("America/Dawson", tz);
6f1b0c
+	timezones0.put("America/Los_Angeles", tz);
6f1b0c
+	timezones0.put("America/Vancouver", tz);
6f1b0c
+	timezones0.put("America/Whitehorse", tz);
6f1b0c
+	timezones0.put("US/Pacific-New", tz);
6f1b0c
+	tz = new SimpleTimeZone(-8000 * 3600, "Pacific/Pitcairn");
6f1b0c
+	timezones0.put("Pacific/Pitcairn", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-7000 * 3600, "America/Chihuahua",
6f1b0c
+	   Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("America/Chihuahua", tz);
6f1b0c
+	timezones0.put("America/Mazatlan", tz);
6f1b0c
+	tz = new SimpleTimeZone(-7000 * 3600, "MST7");
6f1b0c
+	timezones0.put("MST7", tz);
6f1b0c
+	timezones0.put("PNT", tz);
6f1b0c
+	timezones0.put("America/Dawson_Creek", tz);
6f1b0c
+	timezones0.put("America/Hermosillo", tz);
6f1b0c
+	timezones0.put("America/Phoenix", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-7000 * 3600, "MST",
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("MST", tz);
6f1b0c
+	timezones0.put("MST7MDT", tz);
6f1b0c
+	timezones0.put("America/Boise", tz);
6f1b0c
+	timezones0.put("America/Cambridge_Bay", tz);
6f1b0c
+	timezones0.put("America/Denver", tz);
6f1b0c
+	timezones0.put("America/Edmonton", tz);
6f1b0c
+	timezones0.put("America/Inuvik", tz);
6f1b0c
+	timezones0.put("America/Shiprock", tz);
6f1b0c
+	timezones0.put("America/Yellowknife", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-6000 * 3600, "America/Cancun",
6f1b0c
+	   Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("America/Cancun", tz);
6f1b0c
+	timezones0.put("America/Merida", tz);
6f1b0c
+	timezones0.put("America/Mexico_City", tz);
6f1b0c
+	timezones0.put("America/Monterrey", tz);
6f1b0c
+	tz = new SimpleTimeZone(-6000 * 3600, "America/Belize");
6f1b0c
+	timezones0.put("America/Belize", tz);
6f1b0c
+	timezones0.put("America/Costa_Rica", tz);
6f1b0c
+	timezones0.put("America/El_Salvador", tz);
6f1b0c
+	timezones0.put("America/Guatemala", tz);
6f1b0c
+	timezones0.put("America/Managua", tz);
6f1b0c
+	timezones0.put("America/Regina", tz);
6f1b0c
+	timezones0.put("America/Swift_Current", tz);
6f1b0c
+	timezones0.put("America/Tegucigalpa", tz);
6f1b0c
+	timezones0.put("Pacific/Galapagos", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-6000 * 3600, "CST",
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("CST", tz);
6f1b0c
+	timezones0.put("CST6CDT", tz);
6f1b0c
+	timezones0.put("America/Chicago", tz);
6f1b0c
+	timezones0.put("America/Indiana/Knox", tz);
6f1b0c
+	timezones0.put("America/Indiana/Petersburg", tz);
6f1b0c
+	timezones0.put("America/Indiana/Vincennes", tz);
6f1b0c
+	timezones0.put("America/Menominee", tz);
6f1b0c
+	timezones0.put("America/North_Dakota/Center", tz);
6f1b0c
+	timezones0.put("America/North_Dakota/New_Salem", tz);
6f1b0c
+	timezones0.put("America/Rainy_River", tz);
6f1b0c
+	timezones0.put("America/Rankin_Inlet", tz);
6f1b0c
+	timezones0.put("America/Winnipeg", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-6000 * 3600, "Pacific/Easter",
6f1b0c
+	   Calendar.OCTOBER, 2, Calendar.SATURDAY, 22000 * 3600,
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SATURDAY, 22000 * 3600);
6f1b0c
+	timezones0.put("Pacific/Easter", tz);
6f1b0c
+	tz = new SimpleTimeZone(-5000 * 3600, "EST5");
6f1b0c
+	timezones0.put("EST5", tz);
6f1b0c
+	timezones0.put("IET", tz);
6f1b0c
+	timezones0.put("America/Atikokan", tz);
6f1b0c
+	timezones0.put("America/Bogota", tz);
6f1b0c
+	timezones0.put("America/Cayman", tz);
6f1b0c
+	timezones0.put("America/Eirunepe", tz);
6f1b0c
+	timezones0.put("America/Guayaquil", tz);
6f1b0c
+	timezones0.put("America/Jamaica", tz);
6f1b0c
+	timezones0.put("America/Lima", tz);
6f1b0c
+	timezones0.put("America/Panama", tz);
6f1b0c
+	timezones0.put("America/Rio_Branco", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-5000 * 3600, "America/Havana",
6f1b0c
+	   Calendar.APRIL, 1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
6f1b0c
+	timezones0.put("America/Havana", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-5000 * 3600, "America/Grand_Turk",
6f1b0c
+	   Calendar.APRIL, 1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
6f1b0c
+	timezones0.put("America/Grand_Turk", tz);
6f1b0c
+	timezones0.put("America/Port-au-Prince", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-5000 * 3600, "EST",
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("EST", tz);
6f1b0c
+	timezones0.put("EST5EDT", tz);
6f1b0c
+	timezones0.put("America/Detroit", tz);
6f1b0c
+	timezones0.put("America/Indiana/Indianapolis", tz);
6f1b0c
+	timezones0.put("America/Indiana/Marengo", tz);
6f1b0c
+	timezones0.put("America/Indiana/Vevay", tz);
6f1b0c
+	timezones0.put("America/Iqaluit", tz);
6f1b0c
+	timezones0.put("America/Kentucky/Louisville", tz);
6f1b0c
+	timezones0.put("America/Kentucky/Monticello", tz);
6f1b0c
+	timezones0.put("America/Montreal", tz);
6f1b0c
+	timezones0.put("America/Nassau", tz);
6f1b0c
+	timezones0.put("America/New_York", tz);
6f1b0c
+	timezones0.put("America/Nipigon", tz);
6f1b0c
+	timezones0.put("America/Pangnirtung", tz);
6f1b0c
+	timezones0.put("America/Thunder_Bay", tz);
6f1b0c
+	timezones0.put("America/Toronto", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-4000 * 3600, "America/Asuncion",
6f1b0c
+	   Calendar.OCTOBER, 3, Calendar.SUNDAY, 0 * 3600,
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SUNDAY, 0 * 3600);
6f1b0c
+	timezones0.put("America/Asuncion", tz);
6f1b0c
+	tz = new SimpleTimeZone(-4000 * 3600, "PRT");
6f1b0c
+	timezones0.put("PRT", tz);
6f1b0c
+	timezones0.put("America/Anguilla", tz);
6f1b0c
+	timezones0.put("America/Antigua", tz);
6f1b0c
+	timezones0.put("America/Aruba", tz);
6f1b0c
+	timezones0.put("America/Barbados", tz);
6f1b0c
+	timezones0.put("America/Blanc-Sablon", tz);
6f1b0c
+	timezones0.put("America/Boa_Vista", tz);
6f1b0c
+	timezones0.put("America/Caracas", tz);
6f1b0c
+	timezones0.put("America/Curacao", tz);
6f1b0c
+	timezones0.put("America/Dominica", tz);
6f1b0c
+	timezones0.put("America/Grenada", tz);
6f1b0c
+	timezones0.put("America/Guadeloupe", tz);
6f1b0c
+	timezones0.put("America/Guyana", tz);
6f1b0c
+	timezones0.put("America/La_Paz", tz);
6f1b0c
+	timezones0.put("America/Manaus", tz);
6f1b0c
+	timezones0.put("America/Martinique", tz);
6f1b0c
+	timezones0.put("America/Montserrat", tz);
6f1b0c
+	timezones0.put("America/Port_of_Spain", tz);
6f1b0c
+	timezones0.put("America/Porto_Velho", tz);
6f1b0c
+	timezones0.put("America/Puerto_Rico", tz);
6f1b0c
+	timezones0.put("America/Santo_Domingo", tz);
6f1b0c
+	timezones0.put("America/St_Kitts", tz);
6f1b0c
+	timezones0.put("America/St_Lucia", tz);
6f1b0c
+	timezones0.put("America/St_Thomas", tz);
6f1b0c
+	timezones0.put("America/St_Vincent", tz);
6f1b0c
+	timezones0.put("America/Tortola", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-4000 * 3600, "America/Campo_Grande",
6f1b0c
+	   Calendar.NOVEMBER, 1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
+	   Calendar.FEBRUARY, -1, Calendar.SUNDAY, 0 * 3600);
6f1b0c
+	timezones0.put("America/Campo_Grande", tz);
6f1b0c
+	timezones0.put("America/Cuiaba", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-4000 * 3600, "America/Goose_Bay",
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SUNDAY, 60000,
6f1b0c
+	   Calendar.NOVEMBER, 1, Calendar.SUNDAY, 60000);
6f1b0c
+	timezones0.put("America/Goose_Bay", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-4000 * 3600, "America/Glace_Bay",
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("America/Glace_Bay", tz);
6f1b0c
+	timezones0.put("America/Halifax", tz);
6f1b0c
+	timezones0.put("America/Moncton", tz);
6f1b0c
+	timezones0.put("America/Thule", tz);
6f1b0c
+	timezones0.put("Atlantic/Bermuda", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-4000 * 3600, "America/Santiago",
6f1b0c
+	   Calendar.OCTOBER, 9, -Calendar.SUNDAY, 0 * 3600,
6f1b0c
+	   Calendar.MARCH, 9, -Calendar.SUNDAY, 0 * 3600);
6f1b0c
+	timezones0.put("America/Santiago", tz);
6f1b0c
+	timezones0.put("Antarctica/Palmer", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-4000 * 3600, "Atlantic/Stanley",
6f1b0c
+	   Calendar.SEPTEMBER, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.APRIL, 3, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("Atlantic/Stanley", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-3500 * 3600, "CNT",
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SUNDAY, 60000,
6f1b0c
+	   Calendar.NOVEMBER, 1, Calendar.SUNDAY, 60000);
6f1b0c
+	timezones0.put("CNT", tz);
6f1b0c
+	timezones0.put("America/St_Johns", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-3000 * 3600, "America/Godthab",
6f1b0c
+	   Calendar.MARCH, 30, -Calendar.SATURDAY, 22000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, 30, -Calendar.SATURDAY, 23000 * 3600);
6f1b0c
+	timezones0.put("America/Godthab", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-3000 * 3600, "America/Miquelon",
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("America/Miquelon", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-3000 * 3600, "America/Montevideo",
6f1b0c
+	   Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("America/Montevideo", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-3000 * 3600, "America/Sao_Paulo",
6f1b0c
+	   Calendar.NOVEMBER, 1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
+	   Calendar.FEBRUARY, -1, Calendar.SUNDAY, 0 * 3600);
6f1b0c
+	timezones0.put("America/Sao_Paulo", tz);
6f1b0c
+	tz = new SimpleTimeZone(-3000 * 3600, "AGT");
6f1b0c
+	timezones0.put("AGT", tz);
6f1b0c
+	timezones0.put("America/Araguaina", tz);
6f1b0c
+	timezones0.put("America/Argentina/Buenos_Aires", tz);
6f1b0c
+	timezones0.put("America/Argentina/Catamarca", tz);
6f1b0c
+	timezones0.put("America/Argentina/Cordoba", tz);
6f1b0c
+	timezones0.put("America/Argentina/Jujuy", tz);
6f1b0c
+	timezones0.put("America/Argentina/La_Rioja", tz);
6f1b0c
+	timezones0.put("America/Argentina/Mendoza", tz);
6f1b0c
+	timezones0.put("America/Argentina/Rio_Gallegos", tz);
6f1b0c
+	timezones0.put("America/Argentina/San_Juan", tz);
6f1b0c
+	timezones0.put("America/Argentina/Tucuman", tz);
6f1b0c
+	timezones0.put("America/Argentina/Ushuaia", tz);
6f1b0c
+	timezones0.put("America/Bahia", tz);
6f1b0c
+	timezones0.put("America/Belem", tz);
6f1b0c
+	timezones0.put("America/Cayenne", tz);
6f1b0c
+	timezones0.put("America/Fortaleza", tz);
6f1b0c
+	timezones0.put("America/Maceio", tz);
6f1b0c
+	timezones0.put("America/Paramaribo", tz);
6f1b0c
+	timezones0.put("America/Recife", tz);
6f1b0c
+	timezones0.put("Antarctica/Rothera", tz);
6f1b0c
+	tz = new SimpleTimeZone(-2000 * 3600, "America/Noronha");
6f1b0c
+	timezones0.put("America/Noronha", tz);
6f1b0c
+	timezones0.put("Atlantic/South_Georgia", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (-1000 * 3600, "America/Scoresbysund",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
6f1b0c
+	timezones0.put("America/Scoresbysund", tz);
6f1b0c
+	timezones0.put("Atlantic/Azores", tz);
6f1b0c
+	tz = new SimpleTimeZone(-1000 * 3600, "Atlantic/Cape_Verde");
6f1b0c
+	timezones0.put("Atlantic/Cape_Verde", tz);
6f1b0c
+	tz = new SimpleTimeZone(0 * 3600, "GMT");
6f1b0c
+	timezones0.put("GMT", tz);
6f1b0c
+	timezones0.put("UTC", tz);
6f1b0c
+	timezones0.put("Africa/Abidjan", tz);
6f1b0c
+	timezones0.put("Africa/Accra", tz);
6f1b0c
+	timezones0.put("Africa/Bamako", tz);
6f1b0c
+	timezones0.put("Africa/Banjul", tz);
6f1b0c
+	timezones0.put("Africa/Bissau", tz);
6f1b0c
+	timezones0.put("Africa/Casablanca", tz);
6f1b0c
+	timezones0.put("Africa/Conakry", tz);
6f1b0c
+	timezones0.put("Africa/Dakar", tz);
6f1b0c
+	timezones0.put("Africa/El_Aaiun", tz);
6f1b0c
+	timezones0.put("Africa/Freetown", tz);
6f1b0c
+	timezones0.put("Africa/Lome", tz);
6f1b0c
+	timezones0.put("Africa/Monrovia", tz);
6f1b0c
+	timezones0.put("Africa/Nouakchott", tz);
6f1b0c
+	timezones0.put("Africa/Ouagadougou", tz);
6f1b0c
+	timezones0.put("Africa/Sao_Tome", tz);
6f1b0c
+	timezones0.put("America/Danmarkshavn", tz);
6f1b0c
+	timezones0.put("Atlantic/Reykjavik", tz);
6f1b0c
+	timezones0.put("Atlantic/St_Helena", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (0 * 3600, "WET",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 1000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("WET", tz);
6f1b0c
+	timezones0.put("Atlantic/Canary", tz);
6f1b0c
+	timezones0.put("Atlantic/Faroe", tz);
6f1b0c
+	timezones0.put("Atlantic/Madeira", tz);
6f1b0c
+	timezones0.put("Europe/Dublin", tz);
6f1b0c
+	timezones0.put("Europe/Guernsey", tz);
6f1b0c
+	timezones0.put("Europe/Isle_of_Man", tz);
6f1b0c
+	timezones0.put("Europe/Jersey", tz);
6f1b0c
+	timezones0.put("Europe/Lisbon", tz);
6f1b0c
+	timezones0.put("Europe/London", tz);
6f1b0c
+	tz = new SimpleTimeZone(1000 * 3600, "Africa/Algiers");
6f1b0c
+	timezones0.put("Africa/Algiers", tz);
6f1b0c
+	timezones0.put("Africa/Bangui", tz);
6f1b0c
+	timezones0.put("Africa/Brazzaville", tz);
6f1b0c
+	timezones0.put("Africa/Douala", tz);
6f1b0c
+	timezones0.put("Africa/Kinshasa", tz);
6f1b0c
+	timezones0.put("Africa/Lagos", tz);
6f1b0c
+	timezones0.put("Africa/Libreville", tz);
6f1b0c
+	timezones0.put("Africa/Luanda", tz);
6f1b0c
+	timezones0.put("Africa/Malabo", tz);
6f1b0c
+	timezones0.put("Africa/Ndjamena", tz);
6f1b0c
+	timezones0.put("Africa/Niamey", tz);
6f1b0c
+	timezones0.put("Africa/Porto-Novo", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (1000 * 3600, "Africa/Windhoek",
6f1b0c
+	   Calendar.SEPTEMBER, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("Africa/Windhoek", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (1000 * 3600, "CET",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("CET", tz);
6f1b0c
+	timezones0.put("ECT", tz);
6f1b0c
+	timezones0.put("MET", tz);
6f1b0c
+	timezones0.put("Africa/Ceuta", tz);
6f1b0c
+	timezones0.put("Africa/Tunis", tz);
6f1b0c
+	timezones0.put("Arctic/Longyearbyen", tz);
6f1b0c
+	timezones0.put("Atlantic/Jan_Mayen", tz);
6f1b0c
+	timezones0.put("Europe/Amsterdam", tz);
6f1b0c
+	timezones0.put("Europe/Andorra", tz);
6f1b0c
+	timezones0.put("Europe/Belgrade", tz);
6f1b0c
+	timezones0.put("Europe/Berlin", tz);
6f1b0c
+	timezones0.put("Europe/Bratislava", tz);
6f1b0c
+	timezones0.put("Europe/Brussels", tz);
6f1b0c
+	timezones0.put("Europe/Budapest", tz);
6f1b0c
+	timezones0.put("Europe/Copenhagen", tz);
6f1b0c
+	timezones0.put("Europe/Gibraltar", tz);
6f1b0c
+	timezones0.put("Europe/Ljubljana", tz);
6f1b0c
+	timezones0.put("Europe/Luxembourg", tz);
6f1b0c
+	timezones0.put("Europe/Madrid", tz);
6f1b0c
+	timezones0.put("Europe/Malta", tz);
6f1b0c
+	timezones0.put("Europe/Monaco", tz);
6f1b0c
+	timezones0.put("Europe/Oslo", tz);
6f1b0c
+	timezones0.put("Europe/Paris", tz);
6f1b0c
+	timezones0.put("Europe/Podgorica", tz);
6f1b0c
+	timezones0.put("Europe/Prague", tz);
6f1b0c
+	timezones0.put("Europe/Rome", tz);
6f1b0c
+	timezones0.put("Europe/San_Marino", tz);
6f1b0c
+	timezones0.put("Europe/Sarajevo", tz);
6f1b0c
+	timezones0.put("Europe/Skopje", tz);
6f1b0c
+	timezones0.put("Europe/Stockholm", tz);
6f1b0c
+	timezones0.put("Europe/Tirane", tz);
6f1b0c
+	timezones0.put("Europe/Vaduz", tz);
6f1b0c
+	timezones0.put("Europe/Vatican", tz);
6f1b0c
+	timezones0.put("Europe/Vienna", tz);
6f1b0c
+	timezones0.put("Europe/Warsaw", tz);
6f1b0c
+	timezones0.put("Europe/Zagreb", tz);
6f1b0c
+	timezones0.put("Europe/Zurich", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (2000 * 3600, "ART",
6f1b0c
+	   Calendar.APRIL, -1, Calendar.FRIDAY, 0 * 3600,
6f1b0c
+	   Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 24000 * 3600);
6f1b0c
+	timezones0.put("ART", tz);
6f1b0c
+	timezones0.put("Africa/Cairo", tz);
6f1b0c
+	tz = new SimpleTimeZone(2000 * 3600, "CAT");
6f1b0c
+	timezones0.put("CAT", tz);
6f1b0c
+	timezones0.put("Africa/Blantyre", tz);
6f1b0c
+	timezones0.put("Africa/Bujumbura", tz);
6f1b0c
+	timezones0.put("Africa/Gaborone", tz);
6f1b0c
+	timezones0.put("Africa/Harare", tz);
6f1b0c
+	timezones0.put("Africa/Johannesburg", tz);
6f1b0c
+	timezones0.put("Africa/Kigali", tz);
6f1b0c
+	timezones0.put("Africa/Lubumbashi", tz);
6f1b0c
+	timezones0.put("Africa/Lusaka", tz);
6f1b0c
+	timezones0.put("Africa/Maputo", tz);
6f1b0c
+	timezones0.put("Africa/Maseru", tz);
6f1b0c
+	timezones0.put("Africa/Mbabane", tz);
6f1b0c
+	timezones0.put("Africa/Tripoli", tz);
6f1b0c
+	timezones0.put("Asia/Jerusalem", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (2000 * 3600, "Asia/Amman",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.THURSDAY, 0 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.FRIDAY, 1000 * 3600);
6f1b0c
+	timezones0.put("Asia/Amman", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (2000 * 3600, "Asia/Beirut",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
6f1b0c
+	timezones0.put("Asia/Beirut", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (2000 * 3600, "Asia/Damascus",
6f1b0c
+	   Calendar.APRIL, 1, 0, 0 * 3600,
6f1b0c
+	   Calendar.OCTOBER, 1, 0, 0 * 3600);
6f1b0c
+	timezones0.put("Asia/Damascus", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (2000 * 3600, "Asia/Gaza",
6f1b0c
+	   Calendar.APRIL, 1, 0, 0 * 3600,
6f1b0c
+	   Calendar.OCTOBER, 3, Calendar.FRIDAY, 0 * 3600);
6f1b0c
+	timezones0.put("Asia/Gaza", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (2000 * 3600, "EET",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 4000 * 3600);
6f1b0c
+	timezones0.put("EET", tz);
6f1b0c
+	timezones0.put("Asia/Istanbul", tz);
6f1b0c
+	timezones0.put("Asia/Nicosia", tz);
6f1b0c
+	timezones0.put("Europe/Athens", tz);
6f1b0c
+	timezones0.put("Europe/Bucharest", tz);
6f1b0c
+	timezones0.put("Europe/Chisinau", tz);
6f1b0c
+	timezones0.put("Europe/Helsinki", tz);
6f1b0c
+	timezones0.put("Europe/Istanbul", tz);
6f1b0c
+	timezones0.put("Europe/Kiev", tz);
6f1b0c
+	timezones0.put("Europe/Mariehamn", tz);
6f1b0c
+	timezones0.put("Europe/Nicosia", tz);
6f1b0c
+	timezones0.put("Europe/Riga", tz);
6f1b0c
+	timezones0.put("Europe/Simferopol", tz);
6f1b0c
+	timezones0.put("Europe/Sofia", tz);
6f1b0c
+	timezones0.put("Europe/Tallinn", tz);
6f1b0c
+	timezones0.put("Europe/Uzhgorod", tz);
6f1b0c
+	timezones0.put("Europe/Vilnius", tz);
6f1b0c
+	timezones0.put("Europe/Zaporozhye", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (2000 * 3600, "Europe/Kaliningrad",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Europe/Kaliningrad", tz);
6f1b0c
+	timezones0.put("Europe/Minsk", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (3000 * 3600, "Asia/Baghdad",
6f1b0c
+	   Calendar.APRIL, 1, 0, 3000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, 1, 0, 4000 * 3600);
6f1b0c
+	timezones0.put("Asia/Baghdad", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (3000 * 3600, "Europe/Moscow",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Europe/Moscow", tz);
6f1b0c
+	timezones0.put("Europe/Volgograd", tz);
6f1b0c
+	tz = new SimpleTimeZone(3000 * 3600, "EAT");
6f1b0c
+	timezones0.put("EAT", tz);
6f1b0c
+	timezones0.put("Africa/Addis_Ababa", tz);
6f1b0c
+	timezones0.put("Africa/Asmara", tz);
6f1b0c
+	timezones0.put("Africa/Dar_es_Salaam", tz);
6f1b0c
+	timezones0.put("Africa/Djibouti", tz);
6f1b0c
+	timezones0.put("Africa/Kampala", tz);
6f1b0c
+	timezones0.put("Africa/Khartoum", tz);
6f1b0c
+	timezones0.put("Africa/Mogadishu", tz);
6f1b0c
+	timezones0.put("Africa/Nairobi", tz);
6f1b0c
+	timezones0.put("Antarctica/Syowa", tz);
6f1b0c
+	timezones0.put("Asia/Aden", tz);
6f1b0c
+	timezones0.put("Asia/Bahrain", tz);
6f1b0c
+	timezones0.put("Asia/Kuwait", tz);
6f1b0c
+	timezones0.put("Asia/Qatar", tz);
6f1b0c
+	timezones0.put("Asia/Riyadh", tz);
6f1b0c
+	timezones0.put("Indian/Antananarivo", tz);
6f1b0c
+	timezones0.put("Indian/Comoro", tz);
6f1b0c
+	timezones0.put("Indian/Mayotte", tz);
6f1b0c
+	tz = new SimpleTimeZone(3500 * 3600, "Asia/Tehran");
6f1b0c
+	timezones0.put("Asia/Tehran", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (4000 * 3600, "Asia/Baku",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 4000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 5000 * 3600);
6f1b0c
+	timezones0.put("Asia/Baku", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (4000 * 3600, "Asia/Yerevan",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Asia/Yerevan", tz);
6f1b0c
+	timezones0.put("Europe/Samara", tz);
6f1b0c
+	tz = new SimpleTimeZone(4000 * 3600, "NET");
6f1b0c
+	timezones0.put("NET", tz);
6f1b0c
+	timezones0.put("Asia/Dubai", tz);
6f1b0c
+	timezones0.put("Asia/Muscat", tz);
6f1b0c
+	timezones0.put("Asia/Tbilisi", tz);
6f1b0c
+	timezones0.put("Indian/Mahe", tz);
6f1b0c
+	timezones0.put("Indian/Mauritius", tz);
6f1b0c
+	timezones0.put("Indian/Reunion", tz);
6f1b0c
+	tz = new SimpleTimeZone(4500 * 3600, "Asia/Kabul");
6f1b0c
+	timezones0.put("Asia/Kabul", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (5000 * 3600, "Asia/Yekaterinburg",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Asia/Yekaterinburg", tz);
6f1b0c
+	tz = new SimpleTimeZone(5000 * 3600, "PLT");
6f1b0c
+	timezones0.put("PLT", tz);
6f1b0c
+	timezones0.put("Asia/Aqtau", tz);
6f1b0c
+	timezones0.put("Asia/Aqtobe", tz);
6f1b0c
+	timezones0.put("Asia/Ashgabat", tz);
6f1b0c
+	timezones0.put("Asia/Dushanbe", tz);
6f1b0c
+	timezones0.put("Asia/Karachi", tz);
6f1b0c
+	timezones0.put("Asia/Oral", tz);
6f1b0c
+	timezones0.put("Asia/Samarkand", tz);
6f1b0c
+	timezones0.put("Asia/Tashkent", tz);
6f1b0c
+	timezones0.put("Indian/Kerguelen", tz);
6f1b0c
+	timezones0.put("Indian/Maldives", tz);
6f1b0c
+	tz = new SimpleTimeZone(5500 * 3600, "BST");
6f1b0c
+	timezones0.put("BST", tz);
6f1b0c
+	timezones0.put("IST", tz);
6f1b0c
+	timezones0.put("Asia/Calcutta", tz);
6f1b0c
+	timezones0.put("Asia/Colombo", tz);
6f1b0c
+	tz = new SimpleTimeZone(5750 * 3600, "Asia/Katmandu");
6f1b0c
+	timezones0.put("Asia/Katmandu", tz);
6f1b0c
+	tz = new SimpleTimeZone(6000 * 3600, "Antarctica/Mawson");
6f1b0c
+	timezones0.put("Antarctica/Mawson", tz);
6f1b0c
+	timezones0.put("Antarctica/Vostok", tz);
6f1b0c
+	timezones0.put("Asia/Almaty", tz);
6f1b0c
+	timezones0.put("Asia/Bishkek", tz);
6f1b0c
+	timezones0.put("Asia/Dhaka", tz);
6f1b0c
+	timezones0.put("Asia/Qyzylorda", tz);
6f1b0c
+	timezones0.put("Asia/Thimphu", tz);
6f1b0c
+	timezones0.put("Indian/Chagos", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (6000 * 3600, "Asia/Novosibirsk",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Asia/Novosibirsk", tz);
6f1b0c
+	timezones0.put("Asia/Omsk", tz);
6f1b0c
+	tz = new SimpleTimeZone(6500 * 3600, "Asia/Rangoon");
6f1b0c
+	timezones0.put("Asia/Rangoon", tz);
6f1b0c
+	timezones0.put("Indian/Cocos", tz);
6f1b0c
+	tz = new SimpleTimeZone(7000 * 3600, "VST");
6f1b0c
+	timezones0.put("VST", tz);
6f1b0c
+	timezones0.put("Antarctica/Davis", tz);
6f1b0c
+	timezones0.put("Asia/Bangkok", tz);
6f1b0c
+	timezones0.put("Asia/Jakarta", tz);
6f1b0c
+	timezones0.put("Asia/Phnom_Penh", tz);
6f1b0c
+	timezones0.put("Asia/Pontianak", tz);
6f1b0c
+	timezones0.put("Asia/Saigon", tz);
6f1b0c
+	timezones0.put("Asia/Vientiane", tz);
6f1b0c
+	timezones0.put("Indian/Christmas", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (7000 * 3600, "Asia/Hovd",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SATURDAY, 2000 * 3600,
6f1b0c
+	   Calendar.SEPTEMBER, -1, Calendar.SATURDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("Asia/Hovd", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (7000 * 3600, "Asia/Krasnoyarsk",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Asia/Krasnoyarsk", tz);
6f1b0c
+	tz = new SimpleTimeZone(8000 * 3600, "CTT");
6f1b0c
+	timezones0.put("CTT", tz);
6f1b0c
+	timezones0.put("Antarctica/Casey", tz);
6f1b0c
+	timezones0.put("Asia/Brunei", tz);
6f1b0c
+	timezones0.put("Asia/Chongqing", tz);
6f1b0c
+	timezones0.put("Asia/Harbin", tz);
6f1b0c
+	timezones0.put("Asia/Hong_Kong", tz);
6f1b0c
+	timezones0.put("Asia/Kashgar", tz);
6f1b0c
+	timezones0.put("Asia/Kuala_Lumpur", tz);
6f1b0c
+	timezones0.put("Asia/Kuching", tz);
6f1b0c
+	timezones0.put("Asia/Macau", tz);
6f1b0c
+	timezones0.put("Asia/Makassar", tz);
6f1b0c
+	timezones0.put("Asia/Manila", tz);
6f1b0c
+	timezones0.put("Asia/Shanghai", tz);
6f1b0c
+	timezones0.put("Asia/Singapore", tz);
6f1b0c
+	timezones0.put("Asia/Taipei", tz);
6f1b0c
+	timezones0.put("Asia/Urumqi", tz);
6f1b0c
+	timezones0.put("Australia/Perth", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (8000 * 3600, "Asia/Irkutsk",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Asia/Irkutsk", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (8000 * 3600, "Asia/Ulaanbaatar",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SATURDAY, 2000 * 3600,
6f1b0c
+	   Calendar.SEPTEMBER, -1, Calendar.SATURDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("Asia/Ulaanbaatar", tz);
6f1b0c
+	tz = new SimpleTimeZone(8750 * 3600, "Australia/Eucla");
6f1b0c
+	timezones0.put("Australia/Eucla", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (9000 * 3600, "Asia/Choibalsan",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SATURDAY, 2000 * 3600,
6f1b0c
+	   Calendar.SEPTEMBER, -1, Calendar.SATURDAY, 2000 * 3600);
6f1b0c
+	timezones0.put("Asia/Choibalsan", tz);
6f1b0c
+	tz = new SimpleTimeZone(9000 * 3600, "JST");
6f1b0c
+	timezones0.put("JST", tz);
6f1b0c
+	timezones0.put("Asia/Dili", tz);
6f1b0c
+	timezones0.put("Asia/Jayapura", tz);
6f1b0c
+	timezones0.put("Asia/Pyongyang", tz);
6f1b0c
+	timezones0.put("Asia/Seoul", tz);
6f1b0c
+	timezones0.put("Asia/Tokyo", tz);
6f1b0c
+	timezones0.put("Pacific/Palau", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (9000 * 3600, "Asia/Yakutsk",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Asia/Yakutsk", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (9500 * 3600, "Australia/Adelaide",
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Australia/Adelaide", tz);
6f1b0c
+	timezones0.put("Australia/Broken_Hill", tz);
6f1b0c
+	tz = new SimpleTimeZone(9500 * 3600, "ACT");
6f1b0c
+	timezones0.put("ACT", tz);
6f1b0c
+	timezones0.put("Australia/Darwin", tz);
6f1b0c
+	tz = new SimpleTimeZone(10000 * 3600, "Antarctica/DumontDUrville");
6f1b0c
+	timezones0.put("Antarctica/DumontDUrville", tz);
6f1b0c
+	timezones0.put("Australia/Brisbane", tz);
6f1b0c
+	timezones0.put("Australia/Lindeman", tz);
6f1b0c
+	timezones0.put("Pacific/Guam", tz);
6f1b0c
+	timezones0.put("Pacific/Port_Moresby", tz);
6f1b0c
+	timezones0.put("Pacific/Saipan", tz);
6f1b0c
+	timezones0.put("Pacific/Truk", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (10000 * 3600, "Asia/Sakhalin",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Asia/Sakhalin", tz);
6f1b0c
+	timezones0.put("Asia/Vladivostok", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (10000 * 3600, "Australia/Currie",
6f1b0c
+	   Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Australia/Currie", tz);
6f1b0c
+	timezones0.put("Australia/Hobart", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (10000 * 3600, "AET",
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("AET", tz);
6f1b0c
+	timezones0.put("Australia/Melbourne", tz);
6f1b0c
+	timezones0.put("Australia/Sydney", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (10500 * 3600, "Australia/Lord_Howe",
6f1b0c
+	  Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	  Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600, 500 * 3600);
6f1b0c
+	timezones0.put("Australia/Lord_Howe", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (11000 * 3600, "Asia/Magadan",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Asia/Magadan", tz);
6f1b0c
+	tz = new SimpleTimeZone(11000 * 3600, "SST");
6f1b0c
+	timezones0.put("SST", tz);
6f1b0c
+	timezones0.put("Pacific/Efate", tz);
6f1b0c
+	timezones0.put("Pacific/Guadalcanal", tz);
6f1b0c
+	timezones0.put("Pacific/Kosrae", tz);
6f1b0c
+	timezones0.put("Pacific/Noumea", tz);
6f1b0c
+	timezones0.put("Pacific/Ponape", tz);
6f1b0c
+	tz = new SimpleTimeZone(11500 * 3600, "Pacific/Norfolk");
6f1b0c
+	timezones0.put("Pacific/Norfolk", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (12000 * 3600, "NST",
6f1b0c
+	   Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.MARCH, 3, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("NST", tz);
6f1b0c
+	timezones0.put("Antarctica/McMurdo", tz);
6f1b0c
+	timezones0.put("Antarctica/South_Pole", tz);
6f1b0c
+	timezones0.put("Pacific/Auckland", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (12000 * 3600, "Asia/Anadyr",
6f1b0c
+	   Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
6f1b0c
+	   Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
6f1b0c
+	timezones0.put("Asia/Anadyr", tz);
6f1b0c
+	timezones0.put("Asia/Kamchatka", tz);
6f1b0c
+	tz = new SimpleTimeZone(12000 * 3600, "Pacific/Fiji");
6f1b0c
+	timezones0.put("Pacific/Fiji", tz);
6f1b0c
+	timezones0.put("Pacific/Funafuti", tz);
6f1b0c
+	timezones0.put("Pacific/Kwajalein", tz);
6f1b0c
+	timezones0.put("Pacific/Majuro", tz);
6f1b0c
+	timezones0.put("Pacific/Nauru", tz);
6f1b0c
+	timezones0.put("Pacific/Tarawa", tz);
6f1b0c
+	timezones0.put("Pacific/Wake", tz);
6f1b0c
+	timezones0.put("Pacific/Wallis", tz);
6f1b0c
+	tz = new SimpleTimeZone
6f1b0c
+	  (12750 * 3600, "Pacific/Chatham",
6f1b0c
+	   Calendar.OCTOBER, 1, Calendar.SUNDAY, 2750 * 3600,
6f1b0c
+	   Calendar.MARCH, 3, Calendar.SUNDAY, 3750 * 3600);
6f1b0c
+	timezones0.put("Pacific/Chatham", tz);
6f1b0c
+	tz = new SimpleTimeZone(13000 * 3600, "Pacific/Enderbury");
6f1b0c
+	timezones0.put("Pacific/Enderbury", tz);
6f1b0c
+	timezones0.put("Pacific/Tongatapu", tz);
6f1b0c
+	tz = new SimpleTimeZone(14000 * 3600, "Pacific/Kiritimati");
6f1b0c
+	timezones0.put("Pacific/Kiritimati", tz);
6f1b0c
+      }
6f1b0c
+    return timezones0;
6f1b0c
   }
6f1b0c
 
6f1b0c
+  /**
6f1b0c
+   * Maps a time zone name (with optional GMT offset and daylight time
6f1b0c
+   * zone name) to one of the known time zones.  This method called
6f1b0c
+   * with the result of System.getProperty("user.timezone")
6f1b0c
+   * or getDefaultTimeZoneId().  Note that giving one of
6f1b0c
+   * the standard tz data names from ftp://elsie.nci.nih.gov/pub/ is
6f1b0c
+   * preferred.  
6f1b0c
+   * The time zone name can be given as follows:
6f1b0c
+   * (standard zone name)[(GMT offset)[(DST zone name)[DST offset]]]
6f1b0c
+   * 
6f1b0c
+   * 

6f1b0c
+   * If only a (standard zone name) is given (no numbers in the
6f1b0c
+   * String) then it gets mapped directly to the TimeZone with that
6f1b0c
+   * name, if that fails null is returned.
6f1b0c
+   * 

6f1b0c
+   * Alternately, a POSIX-style TZ string can be given, defining the time zone:
6f1b0c
+   * std offset dst offset,date/time,date/time
6f1b0c
+   * See the glibc manual, or the man page for tzset for details
6f1b0c
+   * of this format.
6f1b0c
+   * 

6f1b0c
+   * A GMT offset is the offset to add to the local time to get GMT.
6f1b0c
+   * If a (GMT offset) is included (either in seconds or hours) then
6f1b0c
+   * an attempt is made to find a TimeZone name matching both the name
6f1b0c
+   * and the offset (that doesn't observe daylight time, if the
6f1b0c
+   * timezone observes daylight time then you must include a daylight
6f1b0c
+   * time zone name after the offset), if that fails then a TimeZone
6f1b0c
+   * with the given GMT offset is returned (whether or not the
6f1b0c
+   * TimeZone observes daylight time is ignored), if that also fails
6f1b0c
+   * the GMT TimeZone is returned.
6f1b0c
+   * 

6f1b0c
+   * If the String ends with (GMT offset)(daylight time zone name)
6f1b0c
+   * then an attempt is made to find a TimeZone with the given name and
6f1b0c
+   * GMT offset that also observes (the daylight time zone name is not
6f1b0c
+   * currently used in any other way), if that fails a TimeZone with
6f1b0c
+   * the given GMT offset that observes daylight time is returned, if
6f1b0c
+   * that also fails the GMT TimeZone is returned.
6f1b0c
+   * 

6f1b0c
+   * Examples: In Chicago, the time zone id could be "CST6CDT", but
6f1b0c
+   * the preferred name would be "America/Chicago".  In Indianapolis
6f1b0c
+   * (which does not have Daylight Savings Time) the string could be
6f1b0c
+   * "EST5", but the preferred name would be "America/Indianapolis".
6f1b0c
+   * The standard time zone name for The Netherlands is "Europe/Amsterdam",
6f1b0c
+   * but can also be given as "CET-1CEST".
6f1b0c
+   */
6f1b0c
+  private static TimeZone getDefaultTimeZone(String sysTimeZoneId)
6f1b0c
+  {
6f1b0c
+    String stdName = null;
6f1b0c
+    int stdOffs;
6f1b0c
+    int dstOffs;
6f1b0c
+    try
6f1b0c
+      {
6f1b0c
+	int idLength = sysTimeZoneId.length();
6f1b0c
+
6f1b0c
+	int index = 0;
6f1b0c
+	int prevIndex;
6f1b0c
+	char c;
6f1b0c
+
6f1b0c
+	// get std
6f1b0c
+	do
6f1b0c
+	  c = sysTimeZoneId.charAt(index);
6f1b0c
+	while (c != '+' && c != '-' && c != ',' && c != ':'
6f1b0c
+	       && ! Character.isDigit(c) && c != '\0' && ++index < idLength);
6f1b0c
+
6f1b0c
+	if (index >= idLength)
6f1b0c
+	  return getTimeZoneInternal(sysTimeZoneId);
6f1b0c
+
6f1b0c
+	stdName = sysTimeZoneId.substring(0, index);
6f1b0c
+	prevIndex = index;
6f1b0c
+
6f1b0c
+	// get the std offset
6f1b0c
+	do
6f1b0c
+	  c = sysTimeZoneId.charAt(index++);
6f1b0c
+	while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c))
6f1b0c
+	       && index < idLength);
6f1b0c
+	if (index < idLength)
6f1b0c
+	  index--;
6f1b0c
+
6f1b0c
+	{ // convert the dst string to a millis number
6f1b0c
+	    String offset = sysTimeZoneId.substring(prevIndex, index);
6f1b0c
+	    prevIndex = index;
6f1b0c
+
6f1b0c
+	    if (offset.charAt(0) == '+' || offset.charAt(0) == '-')
6f1b0c
+	      stdOffs = parseTime(offset.substring(1));
6f1b0c
+	    else
6f1b0c
+	      stdOffs = parseTime(offset);
6f1b0c
+
6f1b0c
+	    if (offset.charAt(0) == '-')
6f1b0c
+	      stdOffs = -stdOffs;
6f1b0c
 
6f1b0c
-  /* Look up default timezone */
6f1b0c
-  static
6f1b0c
+	    // TZ timezone offsets are positive when WEST of the meridian.
6f1b0c
+	    stdOffs = -stdOffs;
6f1b0c
+	}
6f1b0c
+
6f1b0c
+	// Done yet? (Format: std offset)
6f1b0c
+	if (index >= idLength)
6f1b0c
+	  {
6f1b0c
+	    // Do we have an existing timezone with that name and offset?
6f1b0c
+	    TimeZone tz = getTimeZoneInternal(stdName);
6f1b0c
+	    if (tz != null)
6f1b0c
+	      if (tz.getRawOffset() == stdOffs)
6f1b0c
+		return tz;
6f1b0c
+
6f1b0c
+	    // Custom then.
6f1b0c
+	    return new SimpleTimeZone(stdOffs, stdName);
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	// get dst
6f1b0c
+	do
6f1b0c
+	  c = sysTimeZoneId.charAt(index);
6f1b0c
+	while (c != '+' && c != '-' && c != ',' && c != ':'
6f1b0c
+	       && ! Character.isDigit(c) && c != '\0' && ++index < idLength);
6f1b0c
+
6f1b0c
+	// Done yet? (Format: std offset dst)
6f1b0c
+	if (index >= idLength)
6f1b0c
+	  {
6f1b0c
+	    // Do we have an existing timezone with that name and offset
6f1b0c
+	    // which has DST?
6f1b0c
+	    TimeZone tz = getTimeZoneInternal(stdName);
6f1b0c
+	    if (tz != null)
6f1b0c
+	      if (tz.getRawOffset() == stdOffs && tz.useDaylightTime())
6f1b0c
+		return tz;
6f1b0c
+
6f1b0c
+	    // Custom then.
6f1b0c
+	    return new SimpleTimeZone(stdOffs, stdName);
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	// get the dst offset
6f1b0c
+	prevIndex = index;
6f1b0c
+	do
6f1b0c
+	  c = sysTimeZoneId.charAt(index++);
6f1b0c
+	while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c))
6f1b0c
+	       && index < idLength);
6f1b0c
+	if (index < idLength)
6f1b0c
+	  index--;
6f1b0c
+
6f1b0c
+	if (index == prevIndex && (c == ',' || c == ';'))
6f1b0c
+	  {
6f1b0c
+	    // Missing dst offset defaults to one hour ahead of standard
6f1b0c
+	    // time.
6f1b0c
+	    dstOffs = stdOffs + 60 * 60 * 1000;
6f1b0c
+	  }
6f1b0c
+	else
6f1b0c
+	  { // convert the dst string to a millis number
6f1b0c
+	    String offset = sysTimeZoneId.substring(prevIndex, index);
6f1b0c
+	    prevIndex = index;
6f1b0c
+
6f1b0c
+	    if (offset.charAt(0) == '+' || offset.charAt(0) == '-')
6f1b0c
+	      dstOffs = parseTime(offset.substring(1));
6f1b0c
+	    else
6f1b0c
+	      dstOffs = parseTime(offset);
6f1b0c
+
6f1b0c
+	    if (offset.charAt(0) == '-')
6f1b0c
+	      dstOffs = -dstOffs;
6f1b0c
+
6f1b0c
+	    // TZ timezone offsets are positive when WEST of the meridian.
6f1b0c
+	    dstOffs = -dstOffs;
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	// Done yet? (Format: std offset dst offset)
6f1b0c
+	// FIXME: We don't support DST without a rule given. Should we?
6f1b0c
+	if (index >= idLength)
6f1b0c
+	  {
6f1b0c
+	    // Time Zone existing with same name, dst and offsets?
6f1b0c
+	    TimeZone tz = getTimeZoneInternal(stdName);
6f1b0c
+	    if (tz != null)
6f1b0c
+	      if (tz.getRawOffset() == stdOffs && tz.useDaylightTime())
6f1b0c
+		{
6f1b0c
+		  if ((tz instanceof SimpleTimeZone)
6f1b0c
+		      && ((SimpleTimeZone) tz).getDSTSavings()
6f1b0c
+			 == (dstOffs - stdOffs))
6f1b0c
+		    return tz;
6f1b0c
+		  if ((tz instanceof ZoneInfo)
6f1b0c
+		      && ((ZoneInfo) tz).getDSTSavings()
6f1b0c
+			 == (dstOffs - stdOffs))
6f1b0c
+		    return tz;
6f1b0c
+		}
6f1b0c
+
6f1b0c
+	    return new SimpleTimeZone(stdOffs, stdName);
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	// get the DST rule
6f1b0c
+	if (sysTimeZoneId.charAt(index) == ','
6f1b0c
+	    || sysTimeZoneId.charAt(index) == ';')
6f1b0c
+	  {
6f1b0c
+	    index++;
6f1b0c
+	    int offs = index;
6f1b0c
+	    while (sysTimeZoneId.charAt(index) != ','
6f1b0c
+	           && sysTimeZoneId.charAt(index) != ';')
6f1b0c
+	      index++;
6f1b0c
+	    String startTime = sysTimeZoneId.substring(offs, index);
6f1b0c
+	    index++;
6f1b0c
+	    String endTime = sysTimeZoneId.substring(index);
6f1b0c
+
6f1b0c
+	    index = startTime.indexOf('/');
6f1b0c
+	    int startMillis;
6f1b0c
+	    int endMillis;
6f1b0c
+	    String startDate;
6f1b0c
+	    String endDate;
6f1b0c
+	    if (index != -1)
6f1b0c
+	      {
6f1b0c
+		startDate = startTime.substring(0, index);
6f1b0c
+		startMillis = parseTime(startTime.substring(index + 1));
6f1b0c
+	      }
6f1b0c
+	    else
6f1b0c
+	      {
6f1b0c
+		startDate = startTime;
6f1b0c
+		// if time isn't given, default to 2:00:00 AM.
6f1b0c
+		startMillis = 2 * 60 * 60 * 1000;
6f1b0c
+	      }
6f1b0c
+	    index = endTime.indexOf('/');
6f1b0c
+	    if (index != -1)
6f1b0c
+	      {
6f1b0c
+		endDate = endTime.substring(0, index);
6f1b0c
+		endMillis = parseTime(endTime.substring(index + 1));
6f1b0c
+	      }
6f1b0c
+	    else
6f1b0c
+	      {
6f1b0c
+		endDate = endTime;
6f1b0c
+		// if time isn't given, default to 2:00:00 AM.
6f1b0c
+		endMillis = 2 * 60 * 60 * 1000;
6f1b0c
+	      }
6f1b0c
+
6f1b0c
+	    int[] start = getDateParams(startDate);
6f1b0c
+	    int[] end = getDateParams(endDate);
6f1b0c
+	    return new SimpleTimeZone(stdOffs, stdName, start[0], start[1],
6f1b0c
+	                              start[2], startMillis, end[0], end[1],
6f1b0c
+	                              end[2], endMillis, (dstOffs - stdOffs));
6f1b0c
+	  }
6f1b0c
+      }
6f1b0c
+
6f1b0c
+    // FIXME: Produce a warning here?
6f1b0c
+    catch (IndexOutOfBoundsException _)
6f1b0c
+      {
6f1b0c
+      }
6f1b0c
+    catch (NumberFormatException _)
6f1b0c
+      {
6f1b0c
+      }
6f1b0c
+
6f1b0c
+    return null;
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Parses and returns the params for a POSIX TZ date field,
6f1b0c
+   * in the format int[]{ month, day, dayOfWeek }, following the
6f1b0c
+   * SimpleTimeZone constructor rules.
6f1b0c
+   */
6f1b0c
+  private static int[] getDateParams(String date)
6f1b0c
   {
6f1b0c
-    // System.loadLibrary("javautil");
6f1b0c
+    int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
6f1b0c
+    int month;
6f1b0c
 
6f1b0c
-    String tzid = System.getProperty("user.timezone");
6f1b0c
+    if (date.charAt(0) == 'M' || date.charAt(0) == 'm')
6f1b0c
+      {
6f1b0c
+	int day;
6f1b0c
+
6f1b0c
+	// Month, week of month, day of week
6f1b0c
+
6f1b0c
+	// "Mm.w.d".  d is between 0 (Sunday) and 6.  Week w is
6f1b0c
+	// between 1 and 5; Week 1 is the first week in which day d
6f1b0c
+	// occurs and Week 5 specifies the last d day in the month.
6f1b0c
+	// Month m is between 1 and 12.
6f1b0c
+
6f1b0c
+	month = Integer.parseInt(date.substring(1, date.indexOf('.')));
6f1b0c
+	int week = Integer.parseInt(date.substring(date.indexOf('.') + 1,
6f1b0c
+	                                           date.lastIndexOf('.')));
6f1b0c
+	int dayOfWeek = Integer.parseInt(date.substring(date.lastIndexOf('.')
6f1b0c
+	                                                + 1));
6f1b0c
+	dayOfWeek++; // Java day of week is one-based, Sunday is first day.
6f1b0c
+
6f1b0c
+ 	if (week == 5)
6f1b0c
+ 	  day = -1; // last day of month is -1 in java, 5 in TZ
6f1b0c
+ 	else
6f1b0c
+	  {
6f1b0c
+	    // First day of week starting on or after.  For example,
6f1b0c
+	    // to specify the second Sunday of April, set month to
6f1b0c
+	    // APRIL, day-of-month to 8, and day-of-week to -SUNDAY.
6f1b0c
+	    day = (week - 1) * 7 + 1;
6f1b0c
+	    dayOfWeek = -dayOfWeek;
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	month--; // Java month is zero-based.
6f1b0c
+	return new int[] { month, day, dayOfWeek };
6f1b0c
+      }
6f1b0c
+
6f1b0c
+    // julian day, either zero-based 0<=n<=365 (incl feb 29)
6f1b0c
+    // or one-based 1<=n<=365 (no feb 29)
6f1b0c
+    int julianDay; // Julian day,
6f1b0c
+
6f1b0c
+    if (date.charAt(0) != 'J' || date.charAt(0) != 'j')
6f1b0c
+      {
6f1b0c
+	julianDay = Integer.parseInt(date.substring(1));
6f1b0c
+	julianDay++; // make 1-based
6f1b0c
+	// Adjust day count to include feb 29.
6f1b0c
+	dayCount = new int[]
6f1b0c
+	           {
6f1b0c
+	             0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335
6f1b0c
+	           };
6f1b0c
+      }
6f1b0c
+    else
6f1b0c
+      // 1-based julian day
6f1b0c
+      julianDay = Integer.parseInt(date);
6f1b0c
+
6f1b0c
+    int i = 11;
6f1b0c
+    while (i > 0)
6f1b0c
+      if (dayCount[i] < julianDay)
6f1b0c
+	break;
6f1b0c
+      else
6f1b0c
+	i--;
6f1b0c
+    julianDay -= dayCount[i];
6f1b0c
+    month = i;
6f1b0c
+    return new int[] { month, julianDay, 0 };
6f1b0c
+  }
6f1b0c
 
6f1b0c
-    if (tzid == null)
6f1b0c
-      tzid = "GMT";
6f1b0c
+  /**
6f1b0c
+   * Parses a time field hh[:mm[:ss]], returning the result
6f1b0c
+   * in milliseconds. No leading sign.
6f1b0c
+   */
6f1b0c
+  private static int parseTime(String time)
6f1b0c
+  {
6f1b0c
+    int millis = 0;
6f1b0c
+    int i = 0;
6f1b0c
 
6f1b0c
-    defaultZone = getTimeZone(tzid);
6f1b0c
+    while (i < time.length())
6f1b0c
+      if (time.charAt(i) == ':')
6f1b0c
+	break;
6f1b0c
+      else
6f1b0c
+	i++;
6f1b0c
+    millis = 60 * 60 * 1000 * Integer.parseInt(time.substring(0, i));
6f1b0c
+    if (i >= time.length())
6f1b0c
+      return millis;
6f1b0c
+
6f1b0c
+    int iprev = ++i;
6f1b0c
+    while (i < time.length())
6f1b0c
+      if (time.charAt(i) == ':')
6f1b0c
+	break;
6f1b0c
+      else
6f1b0c
+	i++;
6f1b0c
+    millis += 60 * 1000 * Integer.parseInt(time.substring(iprev, i));
6f1b0c
+    if (i >= time.length())
6f1b0c
+      return millis;
6f1b0c
+
6f1b0c
+    millis += 1000 * Integer.parseInt(time.substring(++i));
6f1b0c
+    return millis;
6f1b0c
   }
6f1b0c
 
6f1b0c
+  /* This method returns us a time zone id string which is in the
6f1b0c
+     form <standard zone name><GMT offset><daylight time zone name>.
6f1b0c
+     The GMT offset is in seconds, except where it is evenly divisible
6f1b0c
+     by 3600, then it is in hours.  If the zone does not observe
6f1b0c
+     daylight time, then the daylight zone name is omitted.  Examples:
6f1b0c
+     in Chicago, the timezone would be CST6CDT.  In Indianapolis
6f1b0c
+     (which does not have Daylight Savings Time) the string would
6f1b0c
+     be EST5
6f1b0c
+   */
6f1b0c
+  private static native String getDefaultTimeZoneId();
6f1b0c
+  private static native String getTZEnvVar();
6f1b0c
+
6f1b0c
   /**
6f1b0c
    * Gets the time zone offset, for current date, modified in case of 
6f1b0c
    * daylight savings.  This is the offset to add to UTC to get the local
6f1b0c
@@ -916,6 +1449,8 @@ public abstract class TimeZone implement
6f1b0c
 	// TimeZone knows nothing about daylight saving offsets.
6f1b0c
 	offset += ((SimpleTimeZone) this).getDSTSavings();
6f1b0c
       }
6f1b0c
+    if (dst && this instanceof ZoneInfo)
6f1b0c
+      offset += ((ZoneInfo) this).getDSTSavings();
6f1b0c
 
6f1b0c
     StringBuffer sb = new StringBuffer(9);
6f1b0c
     sb.append("GMT");
6f1b0c
@@ -949,30 +1484,67 @@ public abstract class TimeZone implement
6f1b0c
    * @return The time zone for the identifier or GMT, if no such time
6f1b0c
    * zone exists.
6f1b0c
    */
6f1b0c
-  // FIXME: XXX: JCL indicates this and other methods are synchronized.
6f1b0c
-  public static TimeZone getTimeZone(String ID)
6f1b0c
+  private static TimeZone getTimeZoneInternal(String ID)
6f1b0c
   {
6f1b0c
     // First check timezones hash
6f1b0c
-    TimeZone tz = (TimeZone) timezones.get(ID);
6f1b0c
-    if (tz != null)
6f1b0c
+    TimeZone tz = null;
6f1b0c
+    TimeZone tznew = null;
6f1b0c
+    for (int pass = 0; pass < 2; pass++)
6f1b0c
       {
6f1b0c
-	if (tz.getID().equals(ID))
6f1b0c
-	  return tz;
6f1b0c
+	synchronized (TimeZone.class)
6f1b0c
+	  {
6f1b0c
+	    tz = (TimeZone) timezones().get(ID);
6f1b0c
+	    if (tz != null)
6f1b0c
+	      {
6f1b0c
+		if (!tz.getID().equals(ID))
6f1b0c
+		  {
6f1b0c
+		    // We always return a timezone with the requested ID.
6f1b0c
+		    // This is the same behaviour as with JDK1.2.
6f1b0c
+		    tz = (TimeZone) tz.clone();
6f1b0c
+		    tz.setID(ID);
6f1b0c
+		    // We also save the alias, so that we return the same
6f1b0c
+		    // object again if getTimeZone is called with the same
6f1b0c
+		    // alias.
6f1b0c
+		    timezones().put(ID, tz);
6f1b0c
+		  }
6f1b0c
+		return tz;
6f1b0c
+	      }
6f1b0c
+	    else if (tznew != null)
6f1b0c
+	      {
6f1b0c
+		timezones().put(ID, tznew);
6f1b0c
+		return tznew;
6f1b0c
+	      }
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	if (pass == 1 || zoneinfo_dir == null)
6f1b0c
+	  return null;
6f1b0c
 
6f1b0c
-	// We always return a timezone with the requested ID.
6f1b0c
-	// This is the same behaviour as with JDK1.2.
6f1b0c
-	tz = (TimeZone) tz.clone();
6f1b0c
-	tz.setID(ID);
6f1b0c
-	// We also save the alias, so that we return the same
6f1b0c
-	// object again if getTimeZone is called with the same
6f1b0c
-	// alias.
6f1b0c
-	timezones.put(ID, tz);
6f1b0c
-	return tz;
6f1b0c
+	// aliases0 is never changing after first timezones(), so should
6f1b0c
+	// be safe without synchronization.
6f1b0c
+	String zonename = (String) aliases0.get(ID);
6f1b0c
+	if (zonename == null)
6f1b0c
+	  zonename = ID;
6f1b0c
+
6f1b0c
+	// Read the file outside of the critical section, it is expensive.
6f1b0c
+	tznew = ZoneInfo.readTZFile (ID, zoneinfo_dir
6f1b0c
+				     + File.separatorChar + zonename);
6f1b0c
+	if (tznew == null)
6f1b0c
+	  return null;
6f1b0c
       }
6f1b0c
 
6f1b0c
-    // See if the ID is really a GMT offset form.
6f1b0c
-    // Note that GMT is in the table so we know it is different.
6f1b0c
-    if (ID.startsWith("GMT"))
6f1b0c
+    return null;
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Gets the TimeZone for the given ID.
6f1b0c
+   * @param ID the time zone identifier.
6f1b0c
+   * @return The time zone for the identifier or GMT, if no such time
6f1b0c
+   * zone exists.
6f1b0c
+   */
6f1b0c
+  public static TimeZone getTimeZone(String ID)
6f1b0c
+  {
6f1b0c
+    // Check for custom IDs first
6f1b0c
+    if (ID.startsWith("GMT") && ID.length() > 3)
6f1b0c
       {
6f1b0c
 	int pos = 3;
6f1b0c
 	int offset_direction = 1;
6f1b0c
@@ -1017,8 +1589,20 @@ public abstract class TimeZone implement
6f1b0c
 		  }
6f1b0c
 	      }
6f1b0c
 
6f1b0c
-	    return new SimpleTimeZone((hour * (60 * 60 * 1000) +
6f1b0c
-				       minute * (60 * 1000))
6f1b0c
+	    // Custom IDs have to be normalized
6f1b0c
+	    StringBuffer sb = new StringBuffer(9);
6f1b0c
+	    sb.append("GMT");
6f1b0c
+
6f1b0c
+	    sb.append(offset_direction >= 0 ? '+' : '-');
6f1b0c
+	    sb.append((char) ('0' + hour / 10));
6f1b0c
+	    sb.append((char) ('0' + hour % 10));
6f1b0c
+	    sb.append(':');
6f1b0c
+	    sb.append((char) ('0' + minute / 10));
6f1b0c
+	    sb.append((char) ('0' + minute % 10));
6f1b0c
+	    ID = sb.toString();
6f1b0c
+
6f1b0c
+	    return new SimpleTimeZone((hour * (60 * 60 * 1000)
6f1b0c
+				       + minute * (60 * 1000))
6f1b0c
 				      * offset_direction, ID);
6f1b0c
 	  }
6f1b0c
 	catch (NumberFormatException e)
6f1b0c
@@ -1026,8 +1610,11 @@ public abstract class TimeZone implement
6f1b0c
 	  }
6f1b0c
       }
6f1b0c
 
6f1b0c
-    // Finally, return GMT per spec
6f1b0c
-    return getTimeZone("GMT");
6f1b0c
+    TimeZone tz = getTimeZoneInternal(ID);
6f1b0c
+    if (tz != null)
6f1b0c
+      return tz;
6f1b0c
+
6f1b0c
+    return new SimpleTimeZone(0, "GMT");
6f1b0c
   }
6f1b0c
 
6f1b0c
   /**
6f1b0c
@@ -1040,37 +1627,134 @@ public abstract class TimeZone implement
6f1b0c
    */
6f1b0c
   public static String[] getAvailableIDs(int rawOffset)
6f1b0c
   {
6f1b0c
+    synchronized (TimeZone.class)
6f1b0c
+      {
6f1b0c
+	Hashtable h = timezones();
6f1b0c
+	int count = 0;
6f1b0c
+	if (zoneinfo_dir == null)
6f1b0c
+	  {
6f1b0c
+	    Iterator iter = h.entrySet().iterator();
6f1b0c
+	    while (iter.hasNext())
6f1b0c
+	      {
6f1b0c
+		// Don't iterate the values, since we want to count
6f1b0c
+		// doubled values (aliases)
6f1b0c
+		Map.Entry entry = (Map.Entry) iter.next();
6f1b0c
+		if (((TimeZone) entry.getValue()).getRawOffset() == rawOffset)
6f1b0c
+		  count++;
6f1b0c
+	      }
6f1b0c
+
6f1b0c
+	    String[] ids = new String[count];
6f1b0c
+	    count = 0;
6f1b0c
+	    iter = h.entrySet().iterator();
6f1b0c
+	    while (iter.hasNext())
6f1b0c
+	      {
6f1b0c
+		Map.Entry entry = (Map.Entry) iter.next();
6f1b0c
+		if (((TimeZone) entry.getValue()).getRawOffset() == rawOffset)
6f1b0c
+		  ids[count++] = (String) entry.getKey();
6f1b0c
+	      }
6f1b0c
+	    return ids;
6f1b0c
+	  }
6f1b0c
+      }
6f1b0c
+
6f1b0c
+    String[] s = getAvailableIDs();
6f1b0c
     int count = 0;
6f1b0c
-    Iterator iter = timezones.entrySet().iterator();
6f1b0c
-    while (iter.hasNext())
6f1b0c
+    for (int i = 0; i < s.length; i++)
6f1b0c
       {
6f1b0c
-	// Don't iterate the values, since we want to count 
6f1b0c
-	// doubled values (aliases)
6f1b0c
-	Map.Entry entry = (Map.Entry) iter.next();
6f1b0c
-	if (((TimeZone) entry.getValue()).getRawOffset() == rawOffset)
6f1b0c
+	TimeZone t = getTimeZoneInternal(s[i]);
6f1b0c
+	if (t == null || t.getRawOffset() != rawOffset)
6f1b0c
+	  s[i] = null;
6f1b0c
+	else
6f1b0c
 	  count++;
6f1b0c
       }
6f1b0c
-
6f1b0c
     String[] ids = new String[count];
6f1b0c
     count = 0;
6f1b0c
-    iter = timezones.entrySet().iterator();
6f1b0c
-    while (iter.hasNext())
6f1b0c
-      {
6f1b0c
-	Map.Entry entry = (Map.Entry) iter.next();
6f1b0c
-	if (((TimeZone) entry.getValue()).getRawOffset() == rawOffset)
6f1b0c
-	  ids[count++] = (String) entry.getKey();
6f1b0c
-      }
6f1b0c
+    for (int i = 0; i < s.length; i++)
6f1b0c
+    if (s[i] != null)
6f1b0c
+      ids[count++] = s[i];
6f1b0c
+
6f1b0c
     return ids;
6f1b0c
   }
6f1b0c
 
6f1b0c
+  private static int getAvailableIDs(File d, String prefix, ArrayList list)
6f1b0c
+    {
6f1b0c
+      String[] files = d.list();
6f1b0c
+      int count = files.length;
6f1b0c
+      boolean top = prefix.length() == 0;
6f1b0c
+      list.add (files);
6f1b0c
+      for (int i = 0; i < files.length; i++)
6f1b0c
+	{
6f1b0c
+	  if (top
6f1b0c
+	      && (files[i].equals("posix")
6f1b0c
+		  || files[i].equals("right")
6f1b0c
+		  || files[i].endsWith(".tab")
6f1b0c
+		  || aliases0.get(files[i]) != null))
6f1b0c
+	    {
6f1b0c
+	      files[i] = null;
6f1b0c
+	      count--;
6f1b0c
+	      continue;
6f1b0c
+	    }
6f1b0c
+
6f1b0c
+	  File f = new File(d, files[i]);
6f1b0c
+	  if (f.isDirectory())
6f1b0c
+	    {
6f1b0c
+	      count += getAvailableIDs(f, prefix + files[i]
6f1b0c
+				       + File.separatorChar, list) - 1;
6f1b0c
+	      files[i] = null;
6f1b0c
+	    }
6f1b0c
+	  else
6f1b0c
+	    files[i] = prefix + files[i];
6f1b0c
+	}
6f1b0c
+      return count;
6f1b0c
+    }
6f1b0c
+
6f1b0c
   /**
6f1b0c
    * Gets all available IDs.
6f1b0c
    * @return An array of all supported IDs.
6f1b0c
    */
6f1b0c
   public static String[] getAvailableIDs()
6f1b0c
   {
6f1b0c
-    return (String[])
6f1b0c
-      timezones.keySet().toArray(new String[timezones.size()]);
6f1b0c
+    synchronized (TimeZone.class)
6f1b0c
+      {
6f1b0c
+	Hashtable h = timezones();
6f1b0c
+	if (zoneinfo_dir == null)
6f1b0c
+	  return (String[]) h.keySet().toArray(new String[h.size()]);
6f1b0c
+
6f1b0c
+	if (availableIDs != null)
6f1b0c
+	  {
6f1b0c
+	    String[] ids = new String[availableIDs.length];
6f1b0c
+	    for (int i = 0; i < availableIDs.length; i++)
6f1b0c
+	      ids[i] = availableIDs[i];
6f1b0c
+	    return ids;
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	File d = new File(zoneinfo_dir);
6f1b0c
+	ArrayList list = new ArrayList(30);
6f1b0c
+	int count = getAvailableIDs(d, "", list) + aliases0.size();
6f1b0c
+	availableIDs = new String[count];
6f1b0c
+	String[] ids = new String[count];
6f1b0c
+
6f1b0c
+	count = 0;
6f1b0c
+	for (int i = 0; i < list.size(); i++)
6f1b0c
+	  {
6f1b0c
+	    String[] s = (String[]) list.get(i);
6f1b0c
+	    for (int j = 0; j < s.length; j++)
6f1b0c
+	      if (s[j] != null)
6f1b0c
+		{
6f1b0c
+		  availableIDs[count] = s[j];
6f1b0c
+		  ids[count++] = s[j];
6f1b0c
+		}
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	Iterator iter = aliases0.entrySet().iterator();
6f1b0c
+	while (iter.hasNext())
6f1b0c
+	  {
6f1b0c
+	    Map.Entry entry = (Map.Entry) iter.next();
6f1b0c
+	    availableIDs[count] = (String) entry.getKey();
6f1b0c
+	    ids[count++] = (String) entry.getKey();
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	return ids;
6f1b0c
+      }
6f1b0c
   }
6f1b0c
 
6f1b0c
   /**
6f1b0c
@@ -1081,12 +1765,12 @@ public abstract class TimeZone implement
6f1b0c
    */
6f1b0c
   public static TimeZone getDefault()
6f1b0c
   {
6f1b0c
-    return defaultZone;
6f1b0c
+    return defaultZone();
6f1b0c
   }
6f1b0c
 
6f1b0c
   public static void setDefault(TimeZone zone)
6f1b0c
   {
6f1b0c
-    defaultZone = zone;
6f1b0c
+    defaultZone0 = zone;
6f1b0c
   }
6f1b0c
 
6f1b0c
   /**
6f1b0c
@@ -1116,4 +1800,66 @@ public abstract class TimeZone implement
6f1b0c
 	return null;
6f1b0c
       }
6f1b0c
   }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Tries to read the time zone name from a file.
6f1b0c
+   * If the file cannot be read or an IOException occurs null is returned.
6f1b0c
+   * 

6f1b0c
+   * The /etc/sysconfig/clock file is not standard, but a lot of systems
6f1b0c
+   * have it. The file is included by shell scripts and the timezone
6f1b0c
+   * name is defined in ZONE variable.
6f1b0c
+   * This routine should grok it with or without quotes:
6f1b0c
+   * ZONE=America/New_York
6f1b0c
+   * or
6f1b0c
+   * ZONE="Europe/London"
6f1b0c
+   */
6f1b0c
+  private static String readSysconfigClockFile(String file)
6f1b0c
+  {
6f1b0c
+    BufferedReader br = null;
6f1b0c
+    try
6f1b0c
+      {
6f1b0c
+	FileInputStream fis = new FileInputStream(file);
6f1b0c
+	BufferedInputStream bis = new BufferedInputStream(fis);
6f1b0c
+	br = new BufferedReader(new InputStreamReader(bis));
6f1b0c
+
6f1b0c
+	for (String line = br.readLine(); line != null; line = br.readLine())
6f1b0c
+	  {
6f1b0c
+	    line = line.trim();
6f1b0c
+	    if (line.length() < 8 || !line.startsWith("ZONE="))
6f1b0c
+	      continue;
6f1b0c
+	    int posstart = 6;
6f1b0c
+	    int posend;
6f1b0c
+	    if (line.charAt(5) == '"')
6f1b0c
+	      posend = line.indexOf('"', 6);
6f1b0c
+	    else if (line.charAt(5) == '\'')
6f1b0c
+	      posend = line.indexOf('\'', 6);
6f1b0c
+	    else
6f1b0c
+	      {
6f1b0c
+		posstart = 5;
6f1b0c
+		posend = line.length();
6f1b0c
+	      }
6f1b0c
+	    if (posend < 0)
6f1b0c
+	      return null;
6f1b0c
+	    return line.substring(posstart, posend);
6f1b0c
+	  }
6f1b0c
+	return null;
6f1b0c
+      }
6f1b0c
+    catch (IOException ioe)
6f1b0c
+      {
6f1b0c
+	// Parse error, not a proper tzfile.
6f1b0c
+	return null;
6f1b0c
+      }
6f1b0c
+    finally
6f1b0c
+      {
6f1b0c
+	try
6f1b0c
+	  {
6f1b0c
+	    if (br != null)
6f1b0c
+	      br.close();
6f1b0c
+	  }
6f1b0c
+	catch (IOException ioe)
6f1b0c
+	  {
6f1b0c
+	    // Error while close, nothing we can do.
6f1b0c
+	  }
6f1b0c
+      }
6f1b0c
+  }
6f1b0c
 }
6f1b0c
--- libjava/java/lang/System.java.jj	2007-02-23 21:27:25.000000000 +0100
6f1b0c
+++ libjava/java/lang/System.java	2007-02-24 21:47:38.000000000 +0100
6f1b0c
@@ -42,83 +42,6 @@ public final class System
6f1b0c
 
6f1b0c
   public static native long currentTimeMillis ();
6f1b0c
 
6f1b0c
-  // FIXME: When merging with Classpath, remember to remove the call to
6f1b0c
-  // getDefaultTimeZoneId from java.util.Timezone.
6f1b0c
-  private static native String getSystemTimeZone ();
6f1b0c
-
6f1b0c
-  // Get the System Timezone as reported by the OS.  It should be in
6f1b0c
-  // the form PST8PDT so we'll need to parse it and check that it's valid.
6f1b0c
-  // The result is used to set the user.timezone property in init_properties.
6f1b0c
-  // FIXME: Using the code from Classpath for generating the System
6f1b0c
-  // Timezone IMO is suboptimal because it ignores whether the rules for
6f1b0c
-  // DST match up.
6f1b0c
-  private static String getDefaultTimeZoneId ()
6f1b0c
-  {
6f1b0c
-    String sysTimeZoneId = getSystemTimeZone ();
6f1b0c
-
6f1b0c
-    // Check if this is a valid timezone.  Make sure the IDs match
6f1b0c
-    // since getTimeZone returns GMT if no match is found.
6f1b0c
-    TimeZone tz = TimeZone.getTimeZone (sysTimeZoneId);
6f1b0c
-    if (tz.getID ().equals (sysTimeZoneId))
6f1b0c
-      return sysTimeZoneId;
6f1b0c
-
6f1b0c
-    // Check if the base part of sysTimeZoneId is a valid timezone that
6f1b0c
-    // matches with daylight usage and rawOffset.  Make sure the IDs match
6f1b0c
-    // since getTimeZone returns GMT if no match is found.
6f1b0c
-    // First find start of GMT offset info and any Daylight zone name.
6f1b0c
-    int startGMToffset = 0;
6f1b0c
-    int sysTimeZoneIdLength = sysTimeZoneId.length();
6f1b0c
-    for (int i = 0; i < sysTimeZoneIdLength && startGMToffset == 0; i++)
6f1b0c
-      {
6f1b0c
-        if (Character.isDigit (sysTimeZoneId.charAt (i)))
6f1b0c
-	  startGMToffset = i;
6f1b0c
-      }
6f1b0c
-
6f1b0c
-    int startDaylightZoneName = 0;
6f1b0c
-    boolean usesDaylight = false;
6f1b0c
-    for (int i = sysTimeZoneIdLength - 1;
6f1b0c
-         i >= 0 && !Character.isDigit (sysTimeZoneId.charAt (i)); --i)
6f1b0c
-      {
6f1b0c
-        startDaylightZoneName = i;
6f1b0c
-      }
6f1b0c
-    if (startDaylightZoneName > 0)
6f1b0c
-      usesDaylight = true;
6f1b0c
-
6f1b0c
-    int GMToffset = Integer.parseInt (startDaylightZoneName == 0 ?
6f1b0c
-      sysTimeZoneId.substring (startGMToffset) :
6f1b0c
-      sysTimeZoneId.substring (startGMToffset, startDaylightZoneName));
6f1b0c
-
6f1b0c
-    // Offset could be in hours or seconds.  Convert to millis.
6f1b0c
-    if (GMToffset < 24)
6f1b0c
-      GMToffset *= 60 * 60;
6f1b0c
-    GMToffset *= -1000;
6f1b0c
-
6f1b0c
-    String tzBasename = sysTimeZoneId.substring (0, startGMToffset);
6f1b0c
-    tz = TimeZone.getTimeZone (tzBasename);
6f1b0c
-    if (tz.getID ().equals (tzBasename) && tz.getRawOffset () == GMToffset)
6f1b0c
-      {
6f1b0c
-        boolean tzUsesDaylight = tz.useDaylightTime ();
6f1b0c
-        if (usesDaylight && tzUsesDaylight || !usesDaylight && !tzUsesDaylight)
6f1b0c
-          return tzBasename;
6f1b0c
-      }
6f1b0c
-  
6f1b0c
-    // If no match, see if a valid timezone has the same attributes as this
6f1b0c
-    // and then use it instead.
6f1b0c
-    String[] IDs = TimeZone.getAvailableIDs (GMToffset);
6f1b0c
-    for (int i = 0; i < IDs.length; ++i)
6f1b0c
-      {
6f1b0c
-	// FIXME: The daylight savings rules may not match the rules
6f1b0c
-	// for the desired zone.
6f1b0c
-        boolean IDusesDaylight =
6f1b0c
-	  TimeZone.getTimeZone (IDs[i]).useDaylightTime ();
6f1b0c
-        if (usesDaylight && IDusesDaylight || !usesDaylight && !IDusesDaylight)
6f1b0c
-	  return IDs[i];
6f1b0c
-      }
6f1b0c
-
6f1b0c
-    // If all else fails, return null.
6f1b0c
-    return null;
6f1b0c
-  }
6f1b0c
-
6f1b0c
   public static void exit (int status)
6f1b0c
   {
6f1b0c
     Runtime.getRuntime().exit(status);
6f1b0c
--- libjava/posix.cc.jj	2007-02-23 21:17:39.000000000 +0100
6f1b0c
+++ libjava/posix.cc	2007-02-23 21:27:25.000000000 +0100
6f1b0c
@@ -79,6 +79,10 @@ _Jv_platform_initProperties (java::util:
6f1b0c
   if (! tmpdir)
6f1b0c
     tmpdir = "/tmp";
6f1b0c
   SET ("java.io.tmpdir", tmpdir);
6f1b0c
+  const char *zoneinfodir = ::getenv("TZDATA");
6f1b0c
+  if (! zoneinfodir)
6f1b0c
+    zoneinfodir = "/usr/share/zoneinfo";
6f1b0c
+  SET ("gnu.java.util.zoneinfo.dir", zoneinfodir);
6f1b0c
 }
6f1b0c
 
6f1b0c
 static inline void
6f1b0c
--- libjava/gnu/java/util/ZoneInfo.java.jj	2007-02-23 21:27:25.000000000 +0100
6f1b0c
+++ libjava/gnu/java/util/ZoneInfo.java	2007-02-24 19:14:27.000000000 +0100
6f1b0c
@@ -0,0 +1,1149 @@
6f1b0c
+/* gnu.java.util.ZoneInfo
6f1b0c
+   Copyright (C) 2007 Free Software Foundation, Inc.
6f1b0c
+
6f1b0c
+This file is part of GNU Classpath.
6f1b0c
+
6f1b0c
+GNU Classpath is free software; you can redistribute it and/or modify
6f1b0c
+it under the terms of the GNU General Public License as published by
6f1b0c
+the Free Software Foundation; either version 2, or (at your option)
6f1b0c
+any later version.
6f1b0c
+
6f1b0c
+GNU Classpath is distributed in the hope that it will be useful, but
6f1b0c
+WITHOUT ANY WARRANTY; without even the implied warranty of
6f1b0c
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
6f1b0c
+General Public License for more details.
6f1b0c
+
6f1b0c
+You should have received a copy of the GNU General Public License
6f1b0c
+along with GNU Classpath; see the file COPYING.  If not, write to the
6f1b0c
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
6f1b0c
+02110-1301 USA.
6f1b0c
+
6f1b0c
+Linking this library statically or dynamically with other modules is
6f1b0c
+making a combined work based on this library.  Thus, the terms and
6f1b0c
+conditions of the GNU General Public License cover the whole
6f1b0c
+combination.
6f1b0c
+
6f1b0c
+As a special exception, the copyright holders of this library give you
6f1b0c
+permission to link this library with independent modules to produce an
6f1b0c
+executable, regardless of the license terms of these independent
6f1b0c
+modules, and to copy and distribute the resulting executable under
6f1b0c
+terms of your choice, provided that you also meet, for each linked
6f1b0c
+independent module, the terms and conditions of the license of that
6f1b0c
+module.  An independent module is a module which is not derived from
6f1b0c
+or based on this library.  If you modify this library, you may extend
6f1b0c
+this exception to your version of the library, but you are not
6f1b0c
+obligated to do so.  If you do not wish to do so, delete this
6f1b0c
+exception statement from your version. */
6f1b0c
+
6f1b0c
+
6f1b0c
+package gnu.java.util;
6f1b0c
+
6f1b0c
+import java.io.BufferedInputStream;
6f1b0c
+import java.io.DataInputStream;
6f1b0c
+import java.io.EOFException;
6f1b0c
+import java.io.FileInputStream;
6f1b0c
+import java.io.InputStream;
6f1b0c
+import java.io.IOException;
6f1b0c
+import java.util.Calendar;
6f1b0c
+import java.util.Date;
6f1b0c
+import java.util.GregorianCalendar;
6f1b0c
+import java.util.SimpleTimeZone;
6f1b0c
+import java.util.TimeZone;
6f1b0c
+
6f1b0c
+/**
6f1b0c
+ * This class represents more advanced variant of java.util.SimpleTimeZone.
6f1b0c
+ * It can handle zic(8) compiled transition dates plus uses a SimpleTimeZone
6f1b0c
+ * for years beyond last precomputed transition.  Before first precomputed
6f1b0c
+ * transition it assumes no daylight saving was in effect.
6f1b0c
+ * Timezones that never used daylight saving time should use just
6f1b0c
+ * SimpleTimeZone instead of this class.
6f1b0c
+ *
6f1b0c
+ * This object is tightly bound to the Gregorian calendar.  It assumes
6f1b0c
+ * a regular seven days week, and the month lengths are that of the
6f1b0c
+ * Gregorian Calendar.
6f1b0c
+ *
6f1b0c
+ * @see Calendar
6f1b0c
+ * @see GregorianCalendar
6f1b0c
+ * @see SimpleTimeZone
6f1b0c
+ * @author Jakub Jelinek
6f1b0c
+ */
6f1b0c
+public class ZoneInfo extends TimeZone
6f1b0c
+{
6f1b0c
+  private static final int SECS_SHIFT = 22;
6f1b0c
+  private static final long OFFSET_MASK = (1 << 21) - 1;
6f1b0c
+  private static final int OFFSET_SHIFT = 64 - 21;
6f1b0c
+  private static final long IS_DST = 1 << 21;
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * The raw time zone offset in milliseconds to GMT, ignoring
6f1b0c
+   * daylight savings.
6f1b0c
+   * @serial
6f1b0c
+   */
6f1b0c
+  private int rawOffset;
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Cached DST savings for the last transition rule.
6f1b0c
+   */
6f1b0c
+  private int dstSavings;
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Cached flag whether last transition rule uses DST saving.
6f1b0c
+   */
6f1b0c
+  private boolean useDaylight;
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Array of encoded transitions.
6f1b0c
+   * Transition time in UTC seconds since epoch is in the most
6f1b0c
+   * significant 64 - SECS_SHIFT bits, then one bit flag
6f1b0c
+   * whether DST is active and the least significant bits
6f1b0c
+   * containing offset relative to rawOffset.  Both the DST
6f1b0c
+   * flag and relative offset apply to time before the transition
6f1b0c
+   * and after or equal to previous transition if any.
6f1b0c
+   * The array must be sorted.
6f1b0c
+   */
6f1b0c
+  private long[] transitions;
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * SimpleTimeZone rule which applies on or after the latest
6f1b0c
+   * transition.  If the DST changes are not expresible as a
6f1b0c
+   * SimpleTimeZone rule, then the rule should just contain
6f1b0c
+   * the standard time and no DST time.
6f1b0c
+   */
6f1b0c
+  private SimpleTimeZone lastRule;
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Cached GMT SimpleTimeZone object for internal use in
6f1b0c
+   * getOffset method.
6f1b0c
+   */
6f1b0c
+  private static SimpleTimeZone gmtZone = null;
6f1b0c
+
6f1b0c
+  static final long serialVersionUID = -3740626706860383657L;
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Create a ZoneInfo with the given time offset
6f1b0c
+   * from GMT and with daylight savings.
6f1b0c
+   *
6f1b0c
+   * @param rawOffset The time offset from GMT in milliseconds.
6f1b0c
+   * @param id  The identifier of this time zone.
6f1b0c
+   * @param transitions  Array of transition times in UTC seconds since
6f1b0c
+   * Epoch in topmost 42 bits, below that 1 boolean bit whether the time
6f1b0c
+   * before that transition used daylight saving and in bottommost 21
6f1b0c
+   * bits relative daylight saving offset against rawOffset in seconds
6f1b0c
+   * that applies before this transition.
6f1b0c
+   * @param endRule SimpleTimeZone class describing the daylight saving
6f1b0c
+   * rules after the last transition.
6f1b0c
+   */
6f1b0c
+  public ZoneInfo(int rawOffset, String id, long[] transitions,
6f1b0c
+		  SimpleTimeZone lastRule)
6f1b0c
+  {
6f1b0c
+    if (transitions == null || transitions.length < 1)
6f1b0c
+      throw new IllegalArgumentException("transitions must not be null");
6f1b0c
+    if (lastRule == null)
6f1b0c
+      throw new IllegalArgumentException("lastRule must not be null");
6f1b0c
+    this.rawOffset = rawOffset;
6f1b0c
+    this.transitions = transitions;
6f1b0c
+    this.lastRule = lastRule;
6f1b0c
+    setID(id);
6f1b0c
+    computeDSTSavings();
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Gets the time zone offset, for current date, modified in case of
6f1b0c
+   * daylight savings.  This is the offset to add to UTC to get the local
6f1b0c
+   * time.
6f1b0c
+   *
6f1b0c
+   * The day must be a positive number and dayOfWeek must be a positive value
6f1b0c
+   * from Calendar.  dayOfWeek is redundant, but must match the other values
6f1b0c
+   * or an inaccurate result may be returned.
6f1b0c
+   *
6f1b0c
+   * @param era the era of the given date
6f1b0c
+   * @param year the year of the given date
6f1b0c
+   * @param month the month of the given date, 0 for January.
6f1b0c
+   * @param day the day of month
6f1b0c
+   * @param dayOfWeek the day of week; this must match the other fields.
6f1b0c
+   * @param millis the millis in the day (in local standard time)
6f1b0c
+   * @return the time zone offset in milliseconds.
6f1b0c
+   * @throws IllegalArgumentException if arguments are incorrect.
6f1b0c
+   */
6f1b0c
+  public int getOffset(int era, int year, int month, int day, int dayOfWeek,
6f1b0c
+		       int millis)
6f1b0c
+  {
6f1b0c
+    if (gmtZone == null)
6f1b0c
+      gmtZone = new SimpleTimeZone(0, "GMT");
6f1b0c
+
6f1b0c
+    if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY)
6f1b0c
+      throw new IllegalArgumentException("dayOfWeek out of range");
6f1b0c
+    if (month < Calendar.JANUARY || month > Calendar.DECEMBER)
6f1b0c
+      throw new IllegalArgumentException("month out of range:" + month);
6f1b0c
+
6f1b0c
+    if (era != GregorianCalendar.AD)
6f1b0c
+      return (int) (((transitions[0] << OFFSET_SHIFT) >> OFFSET_SHIFT) * 1000);
6f1b0c
+
6f1b0c
+    GregorianCalendar cal = new GregorianCalendar((TimeZone) gmtZone);
6f1b0c
+    cal.set(year, month, day, 0, 0, 0);
6f1b0c
+    if (cal.get(Calendar.DAY_OF_MONTH) != day)
6f1b0c
+      throw new IllegalArgumentException("day out of range");
6f1b0c
+
6f1b0c
+    long date = cal.getTime().getTime() - rawOffset + millis;
6f1b0c
+    long d = (date >= 0 ? date / 1000 : (date + 1) / 1000 - 1);
6f1b0c
+    long transition = findTransition(d);
6f1b0c
+
6f1b0c
+    // For times on or after last transition use lastRule.
6f1b0c
+    if (transition == Long.MAX_VALUE)
6f1b0c
+      return lastRule.getOffset(era, year, month, day, dayOfWeek, millis);
6f1b0c
+
6f1b0c
+    return (int) (((transition << OFFSET_SHIFT) >> OFFSET_SHIFT) * 1000);
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  private long findTransition(long secs)
6f1b0c
+  {
6f1b0c
+    if (secs < (transitions[0] >> SECS_SHIFT))
6f1b0c
+      return transitions[0];
6f1b0c
+
6f1b0c
+    if (secs >= (transitions[transitions.length-1] >> SECS_SHIFT))
6f1b0c
+      return Long.MAX_VALUE;
6f1b0c
+
6f1b0c
+    long val = (secs + 1) << SECS_SHIFT;
6f1b0c
+    int lo = 1;
6f1b0c
+    int hi = transitions.length;
6f1b0c
+    int mid = 1;
6f1b0c
+    while (lo < hi)
6f1b0c
+      {
6f1b0c
+	mid = (lo + hi) / 2;
6f1b0c
+	// secs < (transitions[mid-1] >> SECS_SHIFT)
6f1b0c
+	if (val <= transitions[mid-1])
6f1b0c
+	  hi = mid;
6f1b0c
+	// secs >= (transitions[mid] >> SECS_SHIFT)
6f1b0c
+	else if (val > transitions[mid])
6f1b0c
+	  lo = mid + 1;
6f1b0c
+	else
6f1b0c
+	  break;
6f1b0c
+      }
6f1b0c
+    return transitions[mid];
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Returns the time zone offset to GMT in milliseconds, ignoring
6f1b0c
+   * day light savings.
6f1b0c
+   * @return the time zone offset.
6f1b0c
+   */
6f1b0c
+  public int getRawOffset()
6f1b0c
+  {
6f1b0c
+    return rawOffset;
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Sets the standard time zone offset to GMT.
6f1b0c
+   * @param rawOffset The time offset from GMT in milliseconds.
6f1b0c
+   */
6f1b0c
+  public void setRawOffset(int rawOffset)
6f1b0c
+  {
6f1b0c
+    this.rawOffset = rawOffset;
6f1b0c
+    lastRule.setRawOffset(rawOffset);
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  private void computeDSTSavings()
6f1b0c
+  {
6f1b0c
+    if (lastRule.useDaylightTime())
6f1b0c
+      {
6f1b0c
+	dstSavings = lastRule.getDSTSavings();
6f1b0c
+	useDaylight = true;
6f1b0c
+      }
6f1b0c
+    else
6f1b0c
+      {
6f1b0c
+	dstSavings = 0;
6f1b0c
+	useDaylight = false;
6f1b0c
+	// lastRule might say no DST is in effect simply because
6f1b0c
+	// the DST rules are too complex for SimpleTimeZone, say
6f1b0c
+	// for Asia/Jerusalem.
6f1b0c
+	// Look at the last DST offset if it is newer than current time.
6f1b0c
+	long currentSecs = System.currentTimeMillis() / 1000;
6f1b0c
+	int i;
6f1b0c
+	for (i = transitions.length - 1;
6f1b0c
+	     i >= 0 && currentSecs < (transitions[i] >> SECS_SHIFT);
6f1b0c
+	     i--)
6f1b0c
+	  if ((transitions[i] & IS_DST) != 0)
6f1b0c
+	    {
6f1b0c
+	      dstSavings = (int) (((transitions[i] << OFFSET_SHIFT)
6f1b0c
+				   >> OFFSET_SHIFT) * 1000)
6f1b0c
+			   - rawOffset;
6f1b0c
+	      useDaylight = true;
6f1b0c
+	      break;
6f1b0c
+	    }
6f1b0c
+      }
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Gets the daylight savings offset.  This is a positive offset in
6f1b0c
+   * milliseconds with respect to standard time.  Typically this
6f1b0c
+   * is one hour, but for some time zones this may be half an our.
6f1b0c
+   * @return the daylight savings offset in milliseconds.
6f1b0c
+   */
6f1b0c
+  public int getDSTSavings()
6f1b0c
+  {
6f1b0c
+    return dstSavings;
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Returns if this time zone uses daylight savings time.
6f1b0c
+   * @return true, if we use daylight savings time, false otherwise.
6f1b0c
+   */
6f1b0c
+  public boolean useDaylightTime()
6f1b0c
+  {
6f1b0c
+    return useDaylight;
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Determines if the given date is in daylight savings time.
6f1b0c
+   * @return true, if it is in daylight savings time, false otherwise.
6f1b0c
+   */
6f1b0c
+  public boolean inDaylightTime(Date date)
6f1b0c
+  {
6f1b0c
+    long d = date.getTime();
6f1b0c
+    d = (d >= 0 ? d / 1000 : (d + 1) / 1000 - 1);
6f1b0c
+    long transition = findTransition(d);
6f1b0c
+
6f1b0c
+    // For times on or after last transition use lastRule.
6f1b0c
+    if (transition == Long.MAX_VALUE)
6f1b0c
+      return lastRule.inDaylightTime(date);
6f1b0c
+
6f1b0c
+    return (transition & IS_DST) != 0;
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Generates the hashCode for the SimpleDateFormat object.  It is
6f1b0c
+   * the rawOffset, possibly, if useDaylightSavings is true, xored
6f1b0c
+   * with startYear, startMonth, startDayOfWeekInMonth, ..., endTime.
6f1b0c
+   */
6f1b0c
+  public synchronized int hashCode()
6f1b0c
+  {
6f1b0c
+    int hash = lastRule.hashCode();
6f1b0c
+    // FIXME - hash transitions?
6f1b0c
+    return hash;
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  public synchronized boolean equals(Object o)
6f1b0c
+  {
6f1b0c
+    if (! hasSameRules((TimeZone) o))
6f1b0c
+      return false;
6f1b0c
+
6f1b0c
+    ZoneInfo zone = (ZoneInfo) o;
6f1b0c
+    return getID().equals(zone.getID());
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Test if the other time zone uses the same rule and only
6f1b0c
+   * possibly differs in ID.  This implementation for this particular
6f1b0c
+   * class will return true if the other object is a ZoneInfo,
6f1b0c
+   * the raw offsets and useDaylight are identical and if useDaylight
6f1b0c
+   * is true, also the start and end datas are identical.
6f1b0c
+   * @return true if this zone uses the same rule.
6f1b0c
+   */
6f1b0c
+  public boolean hasSameRules(TimeZone o)
6f1b0c
+  {
6f1b0c
+    if (this == o)
6f1b0c
+      return true;
6f1b0c
+    if (! (o instanceof ZoneInfo))
6f1b0c
+      return false;
6f1b0c
+    ZoneInfo zone = (ZoneInfo) o;
6f1b0c
+    if (zone.hashCode() != hashCode() || rawOffset != zone.rawOffset)
6f1b0c
+      return false;
6f1b0c
+    if (! lastRule.equals(zone.lastRule))
6f1b0c
+      return false;
6f1b0c
+    // FIXME - compare transitions?
6f1b0c
+    return true;
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Returns a string representation of this ZoneInfo object.
6f1b0c
+   * @return a string representation of this ZoneInfo object.
6f1b0c
+   */
6f1b0c
+  public String toString()
6f1b0c
+  {
6f1b0c
+    return getClass().getName() + "[" + "id=" + getID() + ",offset="
6f1b0c
+	   + rawOffset + ",transitions=" + transitions.length
6f1b0c
+	   + ",useDaylight=" + useDaylight
6f1b0c
+	   + (useDaylight ? (",dstSavings=" + dstSavings) : "")
6f1b0c
+	   + ",lastRule=" + lastRule.toString() + "]";
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Reads zic(8) compiled timezone data file from file
6f1b0c
+   * and returns a TimeZone class describing it, either
6f1b0c
+   * SimpleTimeZone or ZoneInfo depending on whether
6f1b0c
+   * it can be described by SimpleTimeZone rule or not.
6f1b0c
+   */
6f1b0c
+  public static TimeZone readTZFile(String id, String file)
6f1b0c
+  {
6f1b0c
+    DataInputStream dis = null;
6f1b0c
+    try
6f1b0c
+      {
6f1b0c
+	FileInputStream fis = new FileInputStream(file);
6f1b0c
+	BufferedInputStream bis = new BufferedInputStream(fis);
6f1b0c
+	dis = new DataInputStream(bis);
6f1b0c
+
6f1b0c
+	// Make sure we are reading a tzfile.
6f1b0c
+	byte[] tzif = new byte[5];
6f1b0c
+	dis.readFully(tzif);
6f1b0c
+	int tzif2 = 4;
6f1b0c
+	if (tzif[0] == 'T' && tzif[1] == 'Z'
6f1b0c
+	    && tzif[2] == 'i' && tzif[3] == 'f')
6f1b0c
+	  {
6f1b0c
+	    if (tzif[4] >= '2')
6f1b0c
+	      tzif2 = 8;
6f1b0c
+	    // Reserved bytes
6f1b0c
+	    skipFully(dis, 16 - 1);
6f1b0c
+	  }
6f1b0c
+	else
6f1b0c
+	  // Darwin has tzdata files that don't start with the TZif marker
6f1b0c
+	  skipFully(dis, 16 - 5);
6f1b0c
+
6f1b0c
+	int ttisgmtcnt = dis.readInt();
6f1b0c
+	int ttisstdcnt = dis.readInt();
6f1b0c
+	int leapcnt = dis.readInt();
6f1b0c
+	int timecnt = dis.readInt();
6f1b0c
+	int typecnt = dis.readInt();
6f1b0c
+	int charcnt = dis.readInt();
6f1b0c
+	if (tzif2 == 8)
6f1b0c
+	  {
6f1b0c
+	    skipFully(dis, timecnt * (4 + 1) + typecnt * (4 + 1 + 1) + charcnt
6f1b0c
+			   + leapcnt * (4 + 4) + ttisgmtcnt + ttisstdcnt);
6f1b0c
+
6f1b0c
+	    dis.readFully(tzif);
6f1b0c
+	    if (tzif[0] != 'T' || tzif[1] != 'Z' || tzif[2] != 'i'
6f1b0c
+		|| tzif[3] != 'f' || tzif[4] < '2')
6f1b0c
+	      return null;
6f1b0c
+
6f1b0c
+	    // Reserved bytes
6f1b0c
+	    skipFully(dis, 16 - 1);
6f1b0c
+	    ttisgmtcnt = dis.readInt();
6f1b0c
+	    ttisstdcnt = dis.readInt();
6f1b0c
+	    leapcnt = dis.readInt();
6f1b0c
+	    timecnt = dis.readInt();
6f1b0c
+	    typecnt = dis.readInt();
6f1b0c
+	    charcnt = dis.readInt();
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	// Sanity checks
6f1b0c
+	if (typecnt <= 0 || timecnt < 0 || charcnt < 0
6f1b0c
+	    || leapcnt < 0 || ttisgmtcnt < 0 || ttisstdcnt < 0
6f1b0c
+	    || ttisgmtcnt > typecnt || ttisstdcnt > typecnt)
6f1b0c
+	  return null;
6f1b0c
+
6f1b0c
+	// Transition times
6f1b0c
+	long[] times = new long[timecnt];
6f1b0c
+	for (int i = 0; i < timecnt; i++)
6f1b0c
+	  if (tzif2 == 8)
6f1b0c
+	    times[i] = dis.readLong();
6f1b0c
+	  else
6f1b0c
+	    times[i] = (long) dis.readInt();
6f1b0c
+
6f1b0c
+	// Transition types
6f1b0c
+	int[] types = new int[timecnt];
6f1b0c
+	for (int i = 0; i < timecnt; i++)
6f1b0c
+	  {
6f1b0c
+	    types[i] = dis.readByte();
6f1b0c
+	    if (types[i] < 0)
6f1b0c
+	      types[i] += 256;
6f1b0c
+	    if (types[i] >= typecnt)
6f1b0c
+	      return null;
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	// Types
6f1b0c
+	int[] offsets = new int[typecnt];
6f1b0c
+	int[] typeflags = new int[typecnt];
6f1b0c
+	for (int i = 0; i < typecnt; i++)
6f1b0c
+	  {
6f1b0c
+	    offsets[i] = dis.readInt();
6f1b0c
+	    if (offsets[i] >= IS_DST / 2 || offsets[i] <= -IS_DST / 2)
6f1b0c
+	      return null;
6f1b0c
+	    int dst = dis.readByte();
6f1b0c
+	    int abbrind = dis.readByte();
6f1b0c
+	    if (abbrind < 0)
6f1b0c
+	      abbrind += 256;
6f1b0c
+	    if (abbrind >= charcnt)
6f1b0c
+	      return null;
6f1b0c
+	    typeflags[i] = (dst != 0 ? (1 << 8) : 0) + abbrind;
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	// Abbrev names
6f1b0c
+	byte[] names = new byte[charcnt];
6f1b0c
+	dis.readFully(names);
6f1b0c
+
6f1b0c
+	// Leap transitions, for now ignore
6f1b0c
+	skipFully(dis, leapcnt * (tzif2 + 4) + ttisstdcnt + ttisgmtcnt);
6f1b0c
+
6f1b0c
+	// tzIf2 format has optional POSIX TZ env string
6f1b0c
+	String tzstr = null;
6f1b0c
+	if (tzif2 == 8 && dis.readByte() == '\n')
6f1b0c
+	  {
6f1b0c
+	    tzstr = dis.readLine();
6f1b0c
+	    if (tzstr.length() <= 0)
6f1b0c
+	      tzstr = null;
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	// Get std/dst_offset and dst/non-dst time zone names.
6f1b0c
+	int std_ind = -1;
6f1b0c
+	int dst_ind = -1;
6f1b0c
+	if (timecnt == 0)
6f1b0c
+	  std_ind = 0;
6f1b0c
+	else
6f1b0c
+	  for (int i = timecnt - 1; i >= 0; i--)
6f1b0c
+	    {
6f1b0c
+	      if (std_ind == -1 && (typeflags[types[i]] & (1 << 8)) == 0)
6f1b0c
+		std_ind = types[i];
6f1b0c
+	      else if (dst_ind == -1 && (typeflags[types[i]] & (1 << 8)) != 0)
6f1b0c
+		dst_ind = types[i];
6f1b0c
+	      if (dst_ind != -1 && std_ind != -1)
6f1b0c
+		break;
6f1b0c
+	    }
6f1b0c
+
6f1b0c
+	if (std_ind == -1)
6f1b0c
+	  return null;
6f1b0c
+
6f1b0c
+	int j = typeflags[std_ind] & 255;
6f1b0c
+	while (j < charcnt && names[j] != 0)
6f1b0c
+	  j++;
6f1b0c
+	String std_zonename = new String(names, typeflags[std_ind] & 255,
6f1b0c
+					 j - (typeflags[std_ind] & 255),
6f1b0c
+					 "ASCII");
6f1b0c
+
6f1b0c
+	String dst_zonename = "";
6f1b0c
+	if (dst_ind != -1)
6f1b0c
+	  {
6f1b0c
+	    j = typeflags[dst_ind] & 255;
6f1b0c
+	    while (j < charcnt && names[j] != 0)
6f1b0c
+	      j++;
6f1b0c
+	    dst_zonename = new String(names, typeflags[dst_ind] & 255,
6f1b0c
+				      j - (typeflags[dst_ind] & 255), "ASCII");
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	// Only use gmt offset when necessary.
6f1b0c
+	// Also special case GMT+/- timezones.
6f1b0c
+	String std_offset_string = "";
6f1b0c
+	String dst_offset_string = "";
6f1b0c
+	if (tzstr == null
6f1b0c
+	    && (dst_ind != -1
6f1b0c
+		|| (offsets[std_ind] != 0
6f1b0c
+		    && !std_zonename.startsWith("GMT+")
6f1b0c
+		    && !std_zonename.startsWith("GMT-"))))
6f1b0c
+	  {
6f1b0c
+	    std_offset_string = Integer.toString(-offsets[std_ind] / 3600);
6f1b0c
+	    int seconds = -offsets[std_ind] % 3600;
6f1b0c
+	    if (seconds != 0)
6f1b0c
+	      {
6f1b0c
+		if (seconds < 0)
6f1b0c
+		  seconds *= -1;
6f1b0c
+		if (seconds < 600)
6f1b0c
+		  std_offset_string += ":0" + Integer.toString(seconds / 60);
6f1b0c
+		else
6f1b0c
+		  std_offset_string += ":" + Integer.toString(seconds / 60);
6f1b0c
+		seconds = seconds % 60;
6f1b0c
+		if (seconds >= 10)
6f1b0c
+		  std_offset_string += ":" + Integer.toString(seconds);
6f1b0c
+		else if (seconds > 0)
6f1b0c
+		  std_offset_string += ":0" + Integer.toString(seconds);
6f1b0c
+	      }
6f1b0c
+
6f1b0c
+	    if (dst_ind != -1 && offsets[dst_ind] != offsets[std_ind] + 3600)
6f1b0c
+	      {
6f1b0c
+		dst_offset_string = Integer.toString(-offsets[dst_ind] / 3600);
6f1b0c
+		seconds = -offsets[dst_ind] % 3600;
6f1b0c
+		if (seconds != 0)
6f1b0c
+		  {
6f1b0c
+		    if (seconds < 0)
6f1b0c
+		      seconds *= -1;
6f1b0c
+		    if (seconds < 600)
6f1b0c
+		      dst_offset_string
6f1b0c
+			+= ":0" + Integer.toString(seconds / 60);
6f1b0c
+		    else
6f1b0c
+		      dst_offset_string
6f1b0c
+			+= ":" + Integer.toString(seconds / 60);
6f1b0c
+		    seconds = seconds % 60;
6f1b0c
+		    if (seconds >= 10)
6f1b0c
+		      dst_offset_string += ":" + Integer.toString(seconds);
6f1b0c
+		    else if (seconds > 0)
6f1b0c
+		      dst_offset_string += ":0" + Integer.toString(seconds);
6f1b0c
+		  }
6f1b0c
+	      }
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	/*
6f1b0c
+	 * If no tzIf2 POSIX TZ string is available and the timezone
6f1b0c
+	 * uses DST, try to guess the last rule by trying to make
6f1b0c
+	 * sense from transitions at 5 years in the future and onwards.
6f1b0c
+	 * tzdata actually uses only 3 forms of rules:
6f1b0c
+	 * fixed date within a month, e.g. change on April, 5th
6f1b0c
+	 * 1st weekday on or after Nth: change on Sun>=15 in April
6f1b0c
+	 * last weekday in a month: change on lastSun in April
6f1b0c
+	 */
6f1b0c
+	String[] change_spec = { null, null };
6f1b0c
+	if (tzstr == null && dst_ind != -1 && timecnt > 10)
6f1b0c
+	  {
6f1b0c
+	    long nowPlus5y = System.currentTimeMillis() / 1000
6f1b0c
+			     + 5 * 365 * 86400;
6f1b0c
+	    int first;
6f1b0c
+
6f1b0c
+	    for (first = timecnt - 1; first >= 0; first--)
6f1b0c
+	      if (times[first] < nowPlus5y
6f1b0c
+		  || (types[first] != std_ind && types[first] != dst_ind)
6f1b0c
+		  || types[first] != types[timecnt - 2 + ((first ^ timecnt) & 1)])
6f1b0c
+		break;
6f1b0c
+	    first++;
6f1b0c
+
6f1b0c
+	    if (timecnt - first >= 10 && types[timecnt - 1] != types[timecnt - 2])
6f1b0c
+	      {
6f1b0c
+		GregorianCalendar cal
6f1b0c
+		  = new GregorianCalendar(new SimpleTimeZone(0, "GMT"));
6f1b0c
+
6f1b0c
+		int[] values = new int[2 * 11];
6f1b0c
+		int i;
6f1b0c
+		for (i = timecnt - 1; i >= first; i--)
6f1b0c
+		  {
6f1b0c
+		    int base = (i % 2) * 11;
6f1b0c
+		    int offset = offsets[types[i > first ? i - 1 : i + 1]];
6f1b0c
+		    cal.setTime(new Date((times[i] + offset) * 1000));
6f1b0c
+		    if (i >= timecnt - 2)
6f1b0c
+		      {
6f1b0c
+			values[base + 0] = cal.get(Calendar.YEAR);
6f1b0c
+			values[base + 1] = cal.get(Calendar.MONTH);
6f1b0c
+			values[base + 2] = cal.get(Calendar.DAY_OF_MONTH);
6f1b0c
+			values[base + 3]
6f1b0c
+			  = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
6f1b0c
+			values[base + 4] = cal.get(Calendar.DAY_OF_WEEK);
6f1b0c
+			values[base + 5] = cal.get(Calendar.HOUR_OF_DAY);
6f1b0c
+			values[base + 6] = cal.get(Calendar.MINUTE);
6f1b0c
+			values[base + 7] = cal.get(Calendar.SECOND);
6f1b0c
+			values[base + 8] = values[base + 2]; // Range start
6f1b0c
+			values[base + 9] = values[base + 2]; // Range end
6f1b0c
+			values[base + 10] = 0; // Determined type
6f1b0c
+		      }
6f1b0c
+		    else
6f1b0c
+		      {
6f1b0c
+			int year = cal.get(Calendar.YEAR);
6f1b0c
+			int month = cal.get(Calendar.MONTH);
6f1b0c
+			int day_of_month = cal.get(Calendar.DAY_OF_MONTH);
6f1b0c
+			int month_days
6f1b0c
+			  = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
6f1b0c
+			int day_of_week = cal.get(Calendar.DAY_OF_WEEK);
6f1b0c
+			int hour = cal.get(Calendar.HOUR_OF_DAY);
6f1b0c
+			int minute = cal.get(Calendar.MINUTE);
6f1b0c
+			int second = cal.get(Calendar.SECOND);
6f1b0c
+			if (year != values[base + 0] - 1
6f1b0c
+			    || month != values[base + 1]
6f1b0c
+			    || hour != values[base + 5]
6f1b0c
+			    || minute != values[base + 6]
6f1b0c
+			    || second != values[base + 7])
6f1b0c
+			  break;
6f1b0c
+			if (day_of_week == values[base + 4])
6f1b0c
+			  {
6f1b0c
+			    // Either a Sun>=8 or lastSun rule.
6f1b0c
+			    if (day_of_month < values[base + 8])
6f1b0c
+			      values[base + 8] = day_of_month;
6f1b0c
+			    if (day_of_month > values[base + 9])
6f1b0c
+			      values[base + 9] = day_of_month;
6f1b0c
+			    if (values[base + 10] < 0)
6f1b0c
+			      break;
6f1b0c
+			    if (values[base + 10] == 0)
6f1b0c
+			      {
6f1b0c
+				values[base + 10] = 1;
6f1b0c
+				// If day of month > 28, this is
6f1b0c
+				// certainly lastSun rule.
6f1b0c
+				if (values[base + 2] > 28)
6f1b0c
+				  values[base + 2] = 3;
6f1b0c
+				// If day of month isn't in the last
6f1b0c
+				// week, it can't be lastSun rule.
6f1b0c
+				else if (values[base + 2]
6f1b0c
+					 <= values[base + 3] - 7)
6f1b0c
+				  values[base + 3] = 2;
6f1b0c
+			      }
6f1b0c
+			    if (values[base + 10] == 1)
6f1b0c
+			      {
6f1b0c
+				// If day of month is > 28, this is
6f1b0c
+				// certainly lastSun rule.
6f1b0c
+				if (day_of_month > 28)
6f1b0c
+				  values[base + 10] = 3;
6f1b0c
+				// If day of month isn't in the last
6f1b0c
+				// week, it can't be lastSun rule.
6f1b0c
+				else if (day_of_month <= month_days - 7)
6f1b0c
+				  values[base + 10] = 2;
6f1b0c
+			      }
6f1b0c
+			    else if ((values[base + 10] == 2
6f1b0c
+				      && day_of_month > 28)
6f1b0c
+				     || (values[base + 10] == 3
6f1b0c
+					 && day_of_month <= month_days - 7))
6f1b0c
+			      break;
6f1b0c
+			  }
6f1b0c
+			else
6f1b0c
+			  {
6f1b0c
+			    // Must be fixed day in month rule.
6f1b0c
+			    if (day_of_month != values[base + 2]
6f1b0c
+				|| values[base + 10] > 0)
6f1b0c
+			      break;
6f1b0c
+			    values[base + 4] = day_of_week;
6f1b0c
+			    values[base + 10] = -1;
6f1b0c
+			  }
6f1b0c
+			values[base + 0] -= 1;
6f1b0c
+		      }
6f1b0c
+		  }
6f1b0c
+
6f1b0c
+		if (i < first)
6f1b0c
+		  {
6f1b0c
+		    for (i = 0; i < 2; i++)
6f1b0c
+		      {
6f1b0c
+			int base = 11 * i;
6f1b0c
+			if (values[base + 10] == 0)
6f1b0c
+			  continue;
6f1b0c
+			if (values[base + 10] == -1)
6f1b0c
+			  {
6f1b0c
+			    int[] dayCount
6f1b0c
+			      = { 0, 31, 59, 90, 120, 151,
6f1b0c
+				  181, 212, 243, 273, 304, 334 };
6f1b0c
+			    int d = dayCount[values[base + 1]
6f1b0c
+					     - Calendar.JANUARY];
6f1b0c
+			    d += values[base + 2];
6f1b0c
+			    change_spec[i] = ",J" + Integer.toString(d);
6f1b0c
+			  }
6f1b0c
+			else if (values[base + 10] == 2)
6f1b0c
+			  {
6f1b0c
+			    // If we haven't seen all days of the week,
6f1b0c
+			    // we can't be sure what the rule really is.
6f1b0c
+			    if (values[base + 8] + 6 != values[base + 9])
6f1b0c
+			      continue;
6f1b0c
+
6f1b0c
+			    int d;
6f1b0c
+			    d = values[base + 1] - Calendar.JANUARY + 1;
6f1b0c
+			    // E.g. Sun >= 5 is not representable in POSIX
6f1b0c
+			    // TZ env string, use ",Am.n.d" extension
6f1b0c
+			    // where m is month 1 .. 12, n is the date on
6f1b0c
+			    // or after which it happens and d is day
6f1b0c
+			    // of the week, 0 .. 6.  So Sun >= 5 in April
6f1b0c
+			    // is ",A4.5.0".
6f1b0c
+			    if ((values[base + 8] % 7) == 1)
6f1b0c
+			      {
6f1b0c
+				change_spec[i] = ",M" + Integer.toString(d);
6f1b0c
+				d = (values[base + 8] + 6) / 7;
6f1b0c
+			      }
6f1b0c
+			    else
6f1b0c
+			      {
6f1b0c
+				change_spec[i] = ",A" + Integer.toString(d);
6f1b0c
+				d = values[base + 8];
6f1b0c
+			      }
6f1b0c
+			    change_spec[i] += "." + Integer.toString(d);
6f1b0c
+			    d = values[base + 4] - Calendar.SUNDAY;
6f1b0c
+			    change_spec[i] += "." + Integer.toString(d);
6f1b0c
+			  }
6f1b0c
+			else
6f1b0c
+			  {
6f1b0c
+			    // If we don't know whether this is lastSun or
6f1b0c
+			    // Sun >= 22 rule.  That can be either because
6f1b0c
+			    // there was insufficient number of
6f1b0c
+			    // transitions, or February, where it is quite
6f1b0c
+			    // probable we haven't seen any 29th dates.
6f1b0c
+			    // For February, assume lastSun rule, otherwise
6f1b0c
+			    // punt.
6f1b0c
+			    if (values[base + 10] == 1
6f1b0c
+				&& values[base + 1] != Calendar.FEBRUARY)
6f1b0c
+			      continue;
6f1b0c
+
6f1b0c
+			    int d;
6f1b0c
+			    d = values[base + 1] - Calendar.JANUARY + 1;
6f1b0c
+			    change_spec[i] = ",M" + Integer.toString(d);
6f1b0c
+			    d = values[base + 4] - Calendar.SUNDAY;
6f1b0c
+			    change_spec[i] += ".5." + Integer.toString(d);
6f1b0c
+			  }
6f1b0c
+
6f1b0c
+			// Don't add time specification if time is
6f1b0c
+			// 02:00:00.
6f1b0c
+			if (values[base + 5] != 2
6f1b0c
+			    || values[base + 6] != 0
6f1b0c
+			    || values[base + 7] != 0)
6f1b0c
+			  {
6f1b0c
+			    int d = values[base + 5];
6f1b0c
+			    change_spec[i] += "/" + Integer.toString(d);
6f1b0c
+			    if (values[base + 6] != 0 || values[base + 7] != 0)
6f1b0c
+			      {
6f1b0c
+				d = values[base + 6];
6f1b0c
+				if (d < 10)
6f1b0c
+				  change_spec[i]
6f1b0c
+				    += ":0" + Integer.toString(d);
6f1b0c
+				else
6f1b0c
+				  change_spec[i] += ":" + Integer.toString(d);
6f1b0c
+				d = values[base + 7];
6f1b0c
+				if (d >= 10)
6f1b0c
+				   change_spec[i]
6f1b0c
+				     += ":" + Integer.toString(d);
6f1b0c
+				else if (d > 0)
6f1b0c
+				  change_spec[i]
6f1b0c
+				    += ":0" + Integer.toString(d);
6f1b0c
+			      }
6f1b0c
+			  }
6f1b0c
+		      }
6f1b0c
+		    if (types[(timecnt - 1) & -2] == std_ind)
6f1b0c
+		      {
6f1b0c
+			String tmp = change_spec[0];
6f1b0c
+			change_spec[0] = change_spec[1];
6f1b0c
+			change_spec[1] = tmp;
6f1b0c
+		      }
6f1b0c
+		  }
6f1b0c
+	      }
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	if (tzstr == null)
6f1b0c
+	  {
6f1b0c
+	    tzstr = std_zonename + std_offset_string;
6f1b0c
+	    if (change_spec[0] != null && change_spec[1] != null)
6f1b0c
+	      tzstr += dst_zonename + dst_offset_string
6f1b0c
+		       + change_spec[0] + change_spec[1];
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	if (timecnt == 0)
6f1b0c
+	  return new SimpleTimeZone(offsets[std_ind] * 1000,
6f1b0c
+				    id != null ? id : tzstr);
6f1b0c
+
6f1b0c
+	SimpleTimeZone endRule = createLastRule(tzstr);
6f1b0c
+	if (endRule == null)
6f1b0c
+	  return null;
6f1b0c
+
6f1b0c
+	/* Finally adjust the times array into the form the constructor
6f1b0c
+	 * expects.  times[0] is special, the offset and DST flag there
6f1b0c
+	 * are for all times before that transition.  Use the first non-DST
6f1b0c
+	 * type.  For all other transitions, the data file has the type
6f1b0c
+	 * (<offset, isdst, zonename>) for the time interval starting
6f1b0c
+	 */
6f1b0c
+	for (int i = 0; i < typecnt; i++)
6f1b0c
+	  if ((typeflags[i] & (1 << 8)) == 0)
6f1b0c
+	    {
6f1b0c
+	      times[0] = (times[0] << SECS_SHIFT) | (offsets[i] & OFFSET_MASK);
6f1b0c
+	      break;
6f1b0c
+	    }
6f1b0c
+
6f1b0c
+	for (int i = 1; i < timecnt; i++)
6f1b0c
+	  times[i] = (times[i] << SECS_SHIFT)
6f1b0c
+		     | (offsets[types[i - 1]] & OFFSET_MASK)
6f1b0c
+		     | ((typeflags[types[i - 1]] & (1 << 8)) != 0 ? IS_DST : 0);
6f1b0c
+
6f1b0c
+	return new ZoneInfo(offsets[std_ind] * 1000, id != null ? id : tzstr,
6f1b0c
+			    times, endRule);
6f1b0c
+      }
6f1b0c
+    catch (IOException ioe)
6f1b0c
+      {
6f1b0c
+	// Parse error, not a proper tzfile.
6f1b0c
+	return null;
6f1b0c
+      }
6f1b0c
+    finally
6f1b0c
+      {
6f1b0c
+	try
6f1b0c
+	  {
6f1b0c
+	    if (dis != null)
6f1b0c
+	      dis.close();
6f1b0c
+	  }
6f1b0c
+	catch(IOException ioe)
6f1b0c
+	  {
6f1b0c
+	    // Error while close, nothing we can do.
6f1b0c
+	  }
6f1b0c
+      }
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Skips the requested number of bytes in the given InputStream.
6f1b0c
+   * Throws EOFException if not enough bytes could be skipped.
6f1b0c
+   * Negative numbers of bytes to skip are ignored.
6f1b0c
+   */
6f1b0c
+  private static void skipFully(InputStream is, long l) throws IOException
6f1b0c
+  {
6f1b0c
+    while (l > 0)
6f1b0c
+      {
6f1b0c
+	long k = is.skip(l);
6f1b0c
+	if (k <= 0)
6f1b0c
+	  throw new EOFException();
6f1b0c
+	l -= k;
6f1b0c
+      }
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Create a SimpleTimeZone from a POSIX TZ environment string,
6f1b0c
+   * see http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html
6f1b0c
+   * for details.
6f1b0c
+   * It supports also an extension, where Am.n.d rule (m 1 .. 12, n 1 .. 25, d
6f1b0c
+   * 0 .. 6) describes day of week d on or after nth day of month m.
6f1b0c
+   * Say A4.5.0 is Sun>=5 in April.
6f1b0c
+   */
6f1b0c
+  private static SimpleTimeZone createLastRule(String tzstr)
6f1b0c
+  {
6f1b0c
+    String stdName = null;
6f1b0c
+    int stdOffs;
6f1b0c
+    int dstOffs;
6f1b0c
+    try
6f1b0c
+      {
6f1b0c
+	int idLength = tzstr.length();
6f1b0c
+
6f1b0c
+	int index = 0;
6f1b0c
+	int prevIndex;
6f1b0c
+	char c;
6f1b0c
+
6f1b0c
+	// get std
6f1b0c
+	do
6f1b0c
+	  c = tzstr.charAt(index);
6f1b0c
+	while (c != '+' && c != '-' && c != ',' && c != ':'
6f1b0c
+	       && ! Character.isDigit(c) && c != '\0' && ++index < idLength);
6f1b0c
+
6f1b0c
+	if (index >= idLength)
6f1b0c
+	  return new SimpleTimeZone(0, tzstr);
6f1b0c
+
6f1b0c
+	stdName = tzstr.substring(0, index);
6f1b0c
+	prevIndex = index;
6f1b0c
+
6f1b0c
+	// get the std offset
6f1b0c
+	do
6f1b0c
+	  c = tzstr.charAt(index++);
6f1b0c
+	while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c))
6f1b0c
+	       && index < idLength);
6f1b0c
+	if (index < idLength)
6f1b0c
+	  index--;
6f1b0c
+
6f1b0c
+	{ // convert the dst string to a millis number
6f1b0c
+	    String offset = tzstr.substring(prevIndex, index);
6f1b0c
+	    prevIndex = index;
6f1b0c
+
6f1b0c
+	    if (offset.charAt(0) == '+' || offset.charAt(0) == '-')
6f1b0c
+	      stdOffs = parseTime(offset.substring(1));
6f1b0c
+	    else
6f1b0c
+	      stdOffs = parseTime(offset);
6f1b0c
+
6f1b0c
+	    if (offset.charAt(0) == '-')
6f1b0c
+	      stdOffs = -stdOffs;
6f1b0c
+
6f1b0c
+	    // TZ timezone offsets are positive when WEST of the meridian.
6f1b0c
+	    stdOffs = -stdOffs;
6f1b0c
+	}
6f1b0c
+
6f1b0c
+	// Done yet? (Format: std offset)
6f1b0c
+	if (index >= idLength)
6f1b0c
+	  return new SimpleTimeZone(stdOffs, stdName);
6f1b0c
+
6f1b0c
+	// get dst
6f1b0c
+	do
6f1b0c
+	  c = tzstr.charAt(index);
6f1b0c
+	while (c != '+' && c != '-' && c != ',' && c != ':'
6f1b0c
+	       && ! Character.isDigit(c) && c != '\0' && ++index < idLength);
6f1b0c
+
6f1b0c
+	// Done yet? (Format: std offset dst)
6f1b0c
+	if (index >= idLength)
6f1b0c
+	  return new SimpleTimeZone(stdOffs, stdName);
6f1b0c
+
6f1b0c
+	// get the dst offset
6f1b0c
+	prevIndex = index;
6f1b0c
+	do
6f1b0c
+	  c = tzstr.charAt(index++);
6f1b0c
+	while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c))
6f1b0c
+	       && index < idLength);
6f1b0c
+	if (index < idLength)
6f1b0c
+	  index--;
6f1b0c
+
6f1b0c
+	if (index == prevIndex && (c == ',' || c == ';'))
6f1b0c
+	  {
6f1b0c
+	    // Missing dst offset defaults to one hour ahead of standard
6f1b0c
+	    // time.
6f1b0c
+	    dstOffs = stdOffs + 60 * 60 * 1000;
6f1b0c
+	  }
6f1b0c
+	else
6f1b0c
+	  { // convert the dst string to a millis number
6f1b0c
+	    String offset = tzstr.substring(prevIndex, index);
6f1b0c
+	    prevIndex = index;
6f1b0c
+
6f1b0c
+	    if (offset.charAt(0) == '+' || offset.charAt(0) == '-')
6f1b0c
+	      dstOffs = parseTime(offset.substring(1));
6f1b0c
+	    else
6f1b0c
+	      dstOffs = parseTime(offset);
6f1b0c
+
6f1b0c
+	    if (offset.charAt(0) == '-')
6f1b0c
+	      dstOffs = -dstOffs;
6f1b0c
+
6f1b0c
+	    // TZ timezone offsets are positive when WEST of the meridian.
6f1b0c
+	    dstOffs = -dstOffs;
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	// Done yet? (Format: std offset dst offset)
6f1b0c
+	if (index >= idLength)
6f1b0c
+	  return new SimpleTimeZone(stdOffs, stdName);
6f1b0c
+
6f1b0c
+	// get the DST rule
6f1b0c
+	if (tzstr.charAt(index) == ','
6f1b0c
+	    || tzstr.charAt(index) == ';')
6f1b0c
+	  {
6f1b0c
+	    index++;
6f1b0c
+	    int offs = index;
6f1b0c
+	    while (tzstr.charAt(index) != ','
6f1b0c
+		   && tzstr.charAt(index) != ';')
6f1b0c
+	      index++;
6f1b0c
+	    String startTime = tzstr.substring(offs, index);
6f1b0c
+	    index++;
6f1b0c
+	    String endTime = tzstr.substring(index);
6f1b0c
+
6f1b0c
+	    index = startTime.indexOf('/');
6f1b0c
+	    int startMillis;
6f1b0c
+	    int endMillis;
6f1b0c
+	    String startDate;
6f1b0c
+	    String endDate;
6f1b0c
+	    if (index != -1)
6f1b0c
+	      {
6f1b0c
+		startDate = startTime.substring(0, index);
6f1b0c
+		startMillis = parseTime(startTime.substring(index + 1));
6f1b0c
+	      }
6f1b0c
+	    else
6f1b0c
+	      {
6f1b0c
+		startDate = startTime;
6f1b0c
+		// if time isn't given, default to 2:00:00 AM.
6f1b0c
+		startMillis = 2 * 60 * 60 * 1000;
6f1b0c
+	      }
6f1b0c
+	    index = endTime.indexOf('/');
6f1b0c
+	    if (index != -1)
6f1b0c
+	      {
6f1b0c
+		endDate = endTime.substring(0, index);
6f1b0c
+		endMillis = parseTime(endTime.substring(index + 1));
6f1b0c
+	      }
6f1b0c
+	    else
6f1b0c
+	      {
6f1b0c
+		endDate = endTime;
6f1b0c
+		// if time isn't given, default to 2:00:00 AM.
6f1b0c
+		endMillis = 2 * 60 * 60 * 1000;
6f1b0c
+	      }
6f1b0c
+
6f1b0c
+	    int[] start = getDateParams(startDate);
6f1b0c
+	    int[] end = getDateParams(endDate);
6f1b0c
+	    return new SimpleTimeZone(stdOffs, tzstr, start[0], start[1],
6f1b0c
+				      start[2], startMillis, end[0], end[1],
6f1b0c
+				      end[2], endMillis, (dstOffs - stdOffs));
6f1b0c
+	  }
6f1b0c
+      }
6f1b0c
+
6f1b0c
+    catch (IndexOutOfBoundsException _)
6f1b0c
+      {
6f1b0c
+      }
6f1b0c
+    catch (NumberFormatException _)
6f1b0c
+      {
6f1b0c
+      }
6f1b0c
+
6f1b0c
+    return null;
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Parses and returns the params for a POSIX TZ date field,
6f1b0c
+   * in the format int[]{ month, day, dayOfWeek }, following the
6f1b0c
+   * SimpleTimeZone constructor rules.
6f1b0c
+   */
6f1b0c
+  private static int[] getDateParams(String date)
6f1b0c
+  {
6f1b0c
+    int[] dayCount = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
6f1b0c
+    int month;
6f1b0c
+    int type = 0;
6f1b0c
+
6f1b0c
+    if (date.charAt(0) == 'M' || date.charAt(0) == 'm')
6f1b0c
+      type = 1;
6f1b0c
+    else if (date.charAt(0) == 'A' || date.charAt(0) == 'a')
6f1b0c
+      type = 2;
6f1b0c
+
6f1b0c
+    if (type > 0)
6f1b0c
+      {
6f1b0c
+	int day;
6f1b0c
+
6f1b0c
+	// Month, week of month, day of week
6f1b0c
+	// "Mm.w.d".  d is between 0 (Sunday) and 6.  Week w is
6f1b0c
+	// between 1 and 5; Week 1 is the first week in which day d
6f1b0c
+	// occurs and Week 5 specifies the last d day in the month.
6f1b0c
+	// Month m is between 1 and 12.
6f1b0c
+
6f1b0c
+	// Month, day of month, day of week
6f1b0c
+	// ZoneInfo extension, not in POSIX
6f1b0c
+	// "Am.n.d".  d is between 0 (Sunday) and 6.  Day of month n is
6f1b0c
+	// between 1 and 25.  Month m is between 1 and 12.
6f1b0c
+
6f1b0c
+	month = Integer.parseInt(date.substring(1, date.indexOf('.')));
6f1b0c
+	int week = Integer.parseInt(date.substring(date.indexOf('.') + 1,
6f1b0c
+						   date.lastIndexOf('.')));
6f1b0c
+	int dayOfWeek = Integer.parseInt(date.substring(date.lastIndexOf('.')
6f1b0c
+							+ 1));
6f1b0c
+	dayOfWeek++; // Java day of week is one-based, Sunday is first day.
6f1b0c
+
6f1b0c
+	if (type == 2)
6f1b0c
+	  {
6f1b0c
+	    day = week;
6f1b0c
+	    dayOfWeek = -dayOfWeek;
6f1b0c
+	  }
6f1b0c
+ 	else if (week == 5)
6f1b0c
+ 	  day = -1; // last day of month is -1 in java, 5 in TZ
6f1b0c
+ 	else
6f1b0c
+	  {
6f1b0c
+	    // First day of week starting on or after.  For example,
6f1b0c
+	    // to specify the second Sunday of April, set month to
6f1b0c
+	    // APRIL, day-of-month to 8, and day-of-week to -SUNDAY.
6f1b0c
+	    day = (week - 1) * 7 + 1;
6f1b0c
+	    dayOfWeek = -dayOfWeek;
6f1b0c
+	  }
6f1b0c
+
6f1b0c
+	month--; // Java month is zero-based.
6f1b0c
+	return new int[] { month, day, dayOfWeek };
6f1b0c
+      }
6f1b0c
+
6f1b0c
+    // julian day, either zero-based 0<=n<=365 (incl feb 29)
6f1b0c
+    // or one-based 1<=n<=365 (no feb 29)
6f1b0c
+    int julianDay; // Julian day
6f1b0c
+
6f1b0c
+    if (date.charAt(0) != 'J' || date.charAt(0) != 'j')
6f1b0c
+      {
6f1b0c
+	julianDay = Integer.parseInt(date.substring(1));
6f1b0c
+	julianDay++; // make 1-based
6f1b0c
+	// Adjust day count to include feb 29.
6f1b0c
+	dayCount = new int[]
6f1b0c
+		   {
6f1b0c
+		     0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335
6f1b0c
+		   };
6f1b0c
+      }
6f1b0c
+    else
6f1b0c
+      // 1-based julian day
6f1b0c
+      julianDay = Integer.parseInt(date);
6f1b0c
+
6f1b0c
+    int i = 11;
6f1b0c
+    while (i > 0)
6f1b0c
+      if (dayCount[i] < julianDay)
6f1b0c
+	break;
6f1b0c
+      else
6f1b0c
+	i--;
6f1b0c
+    julianDay -= dayCount[i];
6f1b0c
+    month = i;
6f1b0c
+    return new int[] { month, julianDay, 0 };
6f1b0c
+  }
6f1b0c
+
6f1b0c
+  /**
6f1b0c
+   * Parses a time field hh[:mm[:ss]], returning the result
6f1b0c
+   * in milliseconds. No leading sign.
6f1b0c
+   */
6f1b0c
+  private static int parseTime(String time)
6f1b0c
+  {
6f1b0c
+    int millis = 0;
6f1b0c
+    int i = 0;
6f1b0c
+
6f1b0c
+    while (i < time.length())
6f1b0c
+      if (time.charAt(i) == ':')
6f1b0c
+	break;
6f1b0c
+      else
6f1b0c
+	i++;
6f1b0c
+    millis = 60 * 60 * 1000 * Integer.parseInt(time.substring(0, i));
6f1b0c
+    if (i >= time.length())
6f1b0c
+      return millis;
6f1b0c
+
6f1b0c
+    int iprev = ++i;
6f1b0c
+    while (i < time.length())
6f1b0c
+      if (time.charAt(i) == ':')
6f1b0c
+	break;
6f1b0c
+      else
6f1b0c
+	i++;
6f1b0c
+    millis += 60 * 1000 * Integer.parseInt(time.substring(iprev, i));
6f1b0c
+    if (i >= time.length())
6f1b0c
+      return millis;
6f1b0c
+
6f1b0c
+    millis += 1000 * Integer.parseInt(time.substring(++i));
6f1b0c
+    return millis;
6f1b0c
+  }
6f1b0c
+}