/[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.20 by iproetel, Tue Aug 12 13:41:27 2003 UTC revision 1.21 by mark, Tue Nov 25 20:18:36 2003 UTC
# Line 1  Line 1 
1  /* java.util.GregorianCalendar  /* java.util.GregorianCalendar
2     Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.     Copyright (C) 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 264  public class GregorianCalendar extends C Line 264  public class GregorianCalendar extends C
264          //          //
265          // The additional leap year factor accounts for the fact that          // The additional leap year factor accounts for the fact that
266          // a leap day is not seen on Jan 1 of the leap year.          // a leap day is not seen on Jan 1 of the leap year.
267            // And on and after the leap day, the leap day has already been
268            // included in dayOfYear.
269          int gregOffset = (year / 400) - (year / 100) + 2;          int gregOffset = (year / 400) - (year / 100) + 2;
270          if (isLeapYear (year, true) && dayOfYear < 31 + 29)          if (isLeapYear (year, true))
271            --gregOffset;            --gregOffset;
272          time += gregOffset * (24 * 60 * 60 * 1000L);          time += gregOffset * (24 * 60 * 60 * 1000L);
273        }        }
# Line 604  public class GregorianCalendar extends C Line 606  public class GregorianCalendar extends C
606          calculateDay(++day, gregorian);          calculateDay(++day, gregorian);
607        }        }
608    
609      fields[DAY_OF_WEEK_IN_MONTH] = (fields[DAY_OF_MONTH] + 6) / 7;      fields[DAY_OF_WEEK_IN_MONTH] = (fields[DAY_OF_MONTH] + 12) / 7;
610    
611      // which day of the week are we (0..6), relative to getFirstDayOfWeek      // which day of the week are we (0..6), relative to getFirstDayOfWeek
612      int relativeWeekday = (7 + fields[DAY_OF_WEEK] - getFirstDayOfWeek()) % 7;      int relativeWeekday = (7 + fields[DAY_OF_WEEK] - getFirstDayOfWeek()) % 7;
613    
614      fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH] - relativeWeekday + 6) / 7;      fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH] - relativeWeekday + 12) / 7;
615    
616      int weekOfYear = (fields[DAY_OF_YEAR] - relativeWeekday + 6) / 7;      int weekOfYear = (fields[DAY_OF_YEAR] - relativeWeekday + 6) / 7;
617    

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