/[classpath]/classpath/java/util/GregorianCalendar.java
ViewVC logotype

Diff of /classpath/java/util/GregorianCalendar.java

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

revision 1.26 by bryce, Tue Jun 15 22:40:39 2004 UTC revision 1.27 by bryce, Fri Oct 8 23:34:03 2004 UTC
# Line 540  public class GregorianCalendar extends C Line 540  public class GregorianCalendar extends C
540      fields[DAY_OF_WEEK] = weekday;      fields[DAY_OF_WEEK] = weekday;
541    
542      // get a first approximation of the year.  This may be one      // get a first approximation of the year.  This may be one
543      // year to big.      // year too big.
544      int year = 1970 + (gregorian      int year = 1970 + (gregorian
545                         ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1)                         ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1)
546                         : ((day - 100) * 4) / (365 * 4 + 1));                         : ((day - 100) * 4) / (365 * 4 + 1));
# Line 709  public class GregorianCalendar extends C Line 709  public class GregorianCalendar extends C
709     * it does what you expect: Jan, 25 + 10 Days is Feb, 4.     * it does what you expect: Jan, 25 + 10 Days is Feb, 4.
710     * @param field the time field. One of the time field constants.     * @param field the time field. One of the time field constants.
711     * @param amount the amount of time.     * @param amount the amount of time.
712       * @exception IllegalArgumentException if <code>field</code> is
713       *   <code>ZONE_OFFSET</code>, <code>DST_OFFSET</code>, or invalid; or
714       *   if <code>amount</code> contains an out-of-range value and the calendar
715       *   is not in lenient mode.
716     */     */
717    public void add(int field, int amount)    public void add(int field, int amount)
718    {    {
# Line 785  public class GregorianCalendar extends C Line 789  public class GregorianCalendar extends C
789          areFieldsSet = false;          areFieldsSet = false;
790          break;          break;
791        case ZONE_OFFSET:        case ZONE_OFFSET:
         complete();  
         fields[ZONE_OFFSET] += amount;  
         time -= amount;  
         break;  
792        case DST_OFFSET:        case DST_OFFSET:
         complete();  
         fields[DST_OFFSET] += amount;  
         isTimeSet = false;  
         break;  
793        default:        default:
794          throw new IllegalArgumentException          throw new IllegalArgumentException("Invalid or unknown field");
           ("Unknown Calendar field: " + field);  
795        }        }
796    }    }
797    

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

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