2362N/A * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * The <code>AbstractCalendar</code> class provides a framework for 0N/A * implementing a concrete calendar system. 0N/A * <p><a name="fixed_date"></a><B>Fixed Date</B><br> 0N/A * For implementing a concrete calendar system, each calendar must 0N/A * have the common date numbering, starting from midnight the onset of 0N/A * Monday, January 1, 1 (Gregorian). It is called a <I>fixed date</I> 0N/A * in this class. January 1, 1 (Gregorian) is fixed date 1. (See 0N/A * Nachum Dershowitz and Edward M. Reingold, <I>CALENDRICAL 0N/A * CALCULATION The Millennium Edition</I>, Section 1.2 for details.) 0N/A * @author Masayoshi Okutsu 0N/A // The constants assume no leap seconds support. 0N/A // The number of days between January 1, 1 and January 1, 1970 (Gregorian) 0N/A return;
// should report an error??? 0N/A int ms =
0;
// time of day 0N/A // adjust to local time if `date' has time zone. 0N/A // We need to calculate the given millis and time zone 0N/A // offset separately for java.util.GregorianCalendar 0N/A // compatibility. (i.e., millis + zoneOffset could cause 0N/A // overflow or underflow, which must be avoided.) Usually 0N/A // days should be 0 and ms is in the range of -13:00 to 0N/A // +14:00. However, we need to deal with extreme cases. 0N/A // at most ms is (DAY_IN_MILLIS - 1) * 2. 0N/A // at most ms is (1 - DAY_IN_MILLIS) * 2. Adding one 0N/A // DAY_IN_MILLIS results in still negative. 0N/A // convert to fixed date (offset from Jan. 1, 1 (Gregorian)) 0N/A // calculate date fields from the fixed date 0N/A // calculate time fields from the time of day 0N/A // adjust time zone and daylight saving 0N/A // 1) 2:30am during starting-DST transition is 0N/A // intrepreted as 2:30am ST 0N/A // 2) 5:00pm during DST is still interpreted as 5:00pm ST 0N/A // 3) 1:30am during ending-DST transition is interpreted 0N/A // as 1:30am ST (after transition) 0N/A // 1) 2:30am during starting-DST transition is 0N/A // intrepreted as 3:30am DT 0N/A // 2) 5:00pm during DST is intrepreted as 5:00pm DT 0N/A // 3) 1:30am during ending-DST transition is interpreted 0N/A // as 1:30am DT/0:30am ST (before transition) 0N/A // If this time of day setting doesn't affect the date, 0N/A // then restore the normalized state. 0N/A * Returns 7 in this default implementation. 0N/A * Returns a date of the given day of week before the given fixed 0N/A * @param fixedDate the fixed date 0N/A * @param dayOfWeek the day of week 0N/A * @return the calculated date 0N/A * Returns a date of the given day of week that is closest to and 0N/A * after the given fixed date. 0N/A * @param fixedDate the fixed date 0N/A * @param dayOfWeek the day of week 0N/A * @return the calculated date 0N/A * Returns a date of the given day of week on or before the given fixed 0N/A * @param fixedDate the fixed date 0N/A * @param dayOfWeek the day of week 0N/A * @return the calculated date 0N/A // public for java.util.GregorianCalendar 0N/A * Returns the fixed date calculated with the specified calendar 0N/A * date. If the specified date is not normalized, its date fields 0N/A * @param date a <code>CalendarDate</code> with which the fixed 0N/A * date is calculated 0N/A * @return the calculated fixed date 0N/A * Calculates calendar fields from the specified fixed date. This 0N/A * method stores the calculated calendar field values in the specified 0N/A * <code>CalendarDate</code>. 0N/A * @param date a <code>CalendarDate</code> to stored the 0N/A * calculated calendar fields. 0N/A * @param fixedDate a fixed date to calculate calendar fields 0N/A if (t <
0 || t >=
24) {
0N/A if (t <
0 || t >=
60) {
0N/A // TODO: Leap second support. 0N/A if (t <
0 || t >=
60) {
0N/A if (t <
0 || t >=
1000) {