OSDN Git Service

* java/text/SimpleDateFormat.java (parse): Clear DST_OFFSET and
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 14 May 2001 17:40:29 +0000 (17:40 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 14 May 2001 17:40:29 +0000 (17:40 +0000)
ZONE_OFFSET just before computing the time.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42076 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/java/text/SimpleDateFormat.java

index 56784e0..e7baaad 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-14  Tom Tromey  <tromey@redhat.com>
+
+       * java/text/SimpleDateFormat.java (parse): Clear DST_OFFSET and
+       ZONE_OFFSET just before computing the time.
+
 2001-05-12  Zack Weinberg  <zackw@stanford.edu>
 
        * Makefile.am (libgcj_la_OBJECTS): Remove libsupc++convenience.la.
index f097605..5b36638 100644 (file)
@@ -655,8 +655,6 @@ public class SimpleDateFormat extends DateFormat
                    found_zone = true;
                    TimeZone tz = TimeZone.getTimeZone (strings[0]);
                    theCalendar.setTimeZone (tz);
-                   theCalendar.clear (Calendar.DST_OFFSET);
-                   theCalendar.clear (Calendar.ZONE_OFFSET);
                    pos.setIndex(index + strings[k].length());
                    break;
                  }
@@ -709,6 +707,10 @@ public class SimpleDateFormat extends DateFormat
 
     try
       {
+       // Clear calendar fields here to force getTime() to correctly
+       // respect DST in the timezone.
+       theCalendar.clear (Calendar.DST_OFFSET);
+       theCalendar.clear (Calendar.ZONE_OFFSET);
         return theCalendar.getTime();
       }
     catch (IllegalArgumentException x)