/[classpath]/classpath/java/text/SimpleDateFormat.java
ViewVC logotype

Diff of /classpath/java/text/SimpleDateFormat.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by tromey, Thu Jul 24 15:40:09 2003 UTC revision 1.20 by mark, Tue Sep 9 22:38:05 2003 UTC
# Line 547  public class SimpleDateFormat extends Da Line 547  public class SimpleDateFormat extends Da
547    {    {
548      int fmt_index = 0;      int fmt_index = 0;
549      int fmt_max = pattern.length();      int fmt_max = pattern.length();
550        Calendar loc_calendar = (Calendar)calendar.clone();
551    
552      calendar.clear();      loc_calendar.clear();
553      boolean saw_timezone = false;      boolean saw_timezone = false;
554      int quote_start = -1;      int quote_start = -1;
555      boolean is2DigitYear = false;      boolean is2DigitYear = false;
# Line 696  public class SimpleDateFormat extends Da Line 697  public class SimpleDateFormat extends Da
697                      found_zone = true;                      found_zone = true;
698                      saw_timezone = true;                      saw_timezone = true;
699                      TimeZone tz = TimeZone.getTimeZone (strings[0]);                      TimeZone tz = TimeZone.getTimeZone (strings[0]);
700                      calendar.setTimeZone (tz);                      loc_calendar.setTimeZone (tz);
701                      calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ());                      loc_calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ());
702                      offset = 0;                      offset = 0;
703                      if (k > 2 && tz instanceof SimpleTimeZone)                      if (k > 2 && tz instanceof SimpleTimeZone)
704                        {                        {
# Line 764  public class SimpleDateFormat extends Da Line 765  public class SimpleDateFormat extends Da
765            }            }
766    
767          // Assign the value and move on.          // Assign the value and move on.
768          calendar.set(calendar_field, value);          loc_calendar.set(calendar_field, value);
769        }        }
770            
771      if (is2DigitYear)      if (is2DigitYear)
772        {        {
773          // Apply the 80-20 heuristic to dermine the full year based on          // Apply the 80-20 heuristic to dermine the full year based on
774          // defaultCenturyStart.          // defaultCenturyStart.
775          int year = defaultCentury + calendar.get(Calendar.YEAR);          int year = defaultCentury + loc_calendar.get(Calendar.YEAR);
776          calendar.set(Calendar.YEAR, year);          loc_calendar.set(Calendar.YEAR, year);
777          if (calendar.getTime().compareTo(defaultCenturyStart) < 0)          if (loc_calendar.getTime().compareTo(defaultCenturyStart) < 0)
778            calendar.set(Calendar.YEAR, year + 100);                  loc_calendar.set(Calendar.YEAR, year + 100);      
779        }        }
780    
781      try      try
# Line 783  public class SimpleDateFormat extends Da Line 784  public class SimpleDateFormat extends Da
784            {            {
785              // Use the real rules to determine whether or not this              // Use the real rules to determine whether or not this
786              // particular time is in daylight savings.              // particular time is in daylight savings.
787              calendar.clear (Calendar.DST_OFFSET);              loc_calendar.clear (Calendar.DST_OFFSET);
788              calendar.clear (Calendar.ZONE_OFFSET);              loc_calendar.clear (Calendar.ZONE_OFFSET);
789            }            }
790          return calendar.getTime();          return loc_calendar.getTime();
791        }        }
792      catch (IllegalArgumentException x)      catch (IllegalArgumentException x)
793        {        {

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26