ICU-6691 Use most recently set year field in handleGetExtendedYear
X-SVN-Rev: 27738
This commit is contained in:
parent
e6b90eac0d
commit
828ca4ece7
@ -1020,6 +1020,14 @@ Calendar::setTimeInMillis( double millis, UErrorCode& status ) {
|
||||
fTime = millis;
|
||||
fAreFieldsSet = fAreAllFieldsSet = FALSE;
|
||||
fIsTimeSet = fAreFieldsVirtuallySet = TRUE;
|
||||
|
||||
for (int32_t i=0; i<UCAL_FIELD_COUNT; ++i) {
|
||||
fFields[i] = 0;
|
||||
fStamp[i] = kUnset;
|
||||
fIsSet[i] = FALSE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 1997-2009, International Business Machines Corporation and *
|
||||
* Copyright (C) 1997-2010, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
@ -1174,8 +1174,21 @@ int32_t GregorianCalendar::getActualMaximum(UCalendarDateFields field, UErrorCod
|
||||
|
||||
|
||||
int32_t GregorianCalendar::handleGetExtendedYear() {
|
||||
// the year to return
|
||||
int32_t year = kEpochYear;
|
||||
switch(resolveFields(kYearPrecedence)) {
|
||||
|
||||
// year field to use
|
||||
int32_t yearField = UCAL_EXTENDED_YEAR;
|
||||
|
||||
// There are three separate fields which could be used to
|
||||
// derive the proper year. Use the one most recently set.
|
||||
if (fStamp[yearField] < fStamp[UCAL_YEAR])
|
||||
yearField = UCAL_YEAR;
|
||||
if (fStamp[yearField] < fStamp[UCAL_YEAR_WOY])
|
||||
yearField = UCAL_YEAR_WOY;
|
||||
|
||||
// based on the "best" year field, get the year
|
||||
switch(yearField) {
|
||||
case UCAL_EXTENDED_YEAR:
|
||||
year = internalGet(UCAL_EXTENDED_YEAR, kEpochYear);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user