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 |
|
|
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 |
} |
} |
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 |
|
|