This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

TimeZone fix for daylight saving


We were faliing in some time zones.  This is Jakub's code, tested by
me.

Andrew.


2007-02-09  Jakub Jelinek  <jakub@redhat.com>

	* java/util/TimeZone.java: Handle default (one hour) daylight
	savings.

Index: java/util/TimeZone.java
===================================================================
--- java/util/TimeZone.java	(revision 121750)
+++ java/util/TimeZone.java	(working copy)
@@ -977,7 +977,14 @@
 	if (index < idLength)
 	  index--;
 
-	{ // convert the dst string to a millis number
+	if (index == prevIndex && (c == ',' || c == ';'))
+	  {
+	    // Missing dst offset defaults to one hour ahead of standard
+	    // time.  
+	    dstOffs = stdOffs + 60 * 60 * 1000;
+	  }
+	else
+	  { // convert the dst string to a millis number
 	    String offset = sysTimeZoneId.substring(prevIndex, index);
 	    prevIndex = index;
 
@@ -991,7 +998,7 @@
 
 	    // TZ timezone offsets are positive when WEST of the meridian.
 	    dstOffs = -dstOffs;
-	}
+	  }
 
 	// Done yet? (Format: std offset dst offset)
 	// FIXME: We don't support DST without a rule given. Should we?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]