/[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.20 by mark, Tue Sep 9 22:38:05 2003 UTC revision 1.21 by bryce, Sun Sep 28 03:54:25 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();
     Calendar loc_calendar = (Calendar)calendar.clone();  
550    
551      loc_calendar.clear();      calendar.clear();
552      boolean saw_timezone = false;      boolean saw_timezone = false;
553      int quote_start = -1;      int quote_start = -1;
554      boolean is2DigitYear = false;      boolean is2DigitYear = false;
# Line 697  public class SimpleDateFormat extends Da Line 696  public class SimpleDateFormat extends Da
696                      found_zone = true;                      found_zone = true;
697                      saw_timezone = true;                      saw_timezone = true;
698                      TimeZone tz = TimeZone.getTimeZone (strings[0]);                      TimeZone tz = TimeZone.getTimeZone (strings[0]);
699                      loc_calendar.setTimeZone (tz);                      calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ());
                     loc_calendar.set (Calendar.ZONE_OFFSET, tz.getRawOffset ());  
700                      offset = 0;                      offset = 0;
701                      if (k > 2 && tz instanceof SimpleTimeZone)                      if (k > 2 && tz instanceof SimpleTimeZone)
702                        {                        {
# Line 765  public class SimpleDateFormat extends Da Line 763  public class SimpleDateFormat extends Da
763            }            }
764    
765          // Assign the value and move on.          // Assign the value and move on.
766          loc_calendar.set(calendar_field, value);          calendar.set(calendar_field, value);
767        }        }
768            
769      if (is2DigitYear)      if (is2DigitYear)
770        {        {
771          // Apply the 80-20 heuristic to dermine the full year based on          // Apply the 80-20 heuristic to dermine the full year based on
772          // defaultCenturyStart.          // defaultCenturyStart.
773          int year = defaultCentury + loc_calendar.get(Calendar.YEAR);          int year = defaultCentury + calendar.get(Calendar.YEAR);
774          loc_calendar.set(Calendar.YEAR, year);          calendar.set(Calendar.YEAR, year);
775          if (loc_calendar.getTime().compareTo(defaultCenturyStart) < 0)          if (calendar.getTime().compareTo(defaultCenturyStart) < 0)
776            loc_calendar.set(Calendar.YEAR, year + 100);                  calendar.set(Calendar.YEAR, year + 100);      
777        }        }
778    
779      try      try
# Line 784  public class SimpleDateFormat extends Da Line 782  public class SimpleDateFormat extends Da
782            {            {
783              // Use the real rules to determine whether or not this              // Use the real rules to determine whether or not this
784              // particular time is in daylight savings.              // particular time is in daylight savings.
785              loc_calendar.clear (Calendar.DST_OFFSET);              calendar.clear (Calendar.DST_OFFSET);
786              loc_calendar.clear (Calendar.ZONE_OFFSET);              calendar.clear (Calendar.ZONE_OFFSET);
787            }            }
788          return loc_calendar.getTime();          return calendar.getTime();
789        }        }
790      catch (IllegalArgumentException x)      catch (IllegalArgumentException x)
791        {        {

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

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