/** * Implement abstract Calendar method to return the extended year * defined by the current fields. This will use either the ERA and * YEAR field as the cycle and year-of-cycle, or the EXTENDED_YEAR * field as the continuous year count, depending on which is newer. * @stable ICU 2.8 */ int32_t ChineseCalendar::handleGetExtendedYear() { int32_t year; if (newestStamp(UCAL_ERA, UCAL_YEAR, kUnset) <= fStamp[UCAL_EXTENDED_YEAR]) { year = internalGet(UCAL_EXTENDED_YEAR, 1); // Default to year 1 } else { int32_t cycle = internalGet(UCAL_ERA, 1) - 1; // 0-based cycle year = cycle * 60 + internalGet(UCAL_YEAR, 1); } return year; }
/** * Implement abstract Calendar method to return the extended year * defined by the current fields. This will use either the ERA and * YEAR field as the cycle and year-of-cycle, or the EXTENDED_YEAR * field as the continuous year count, depending on which is newer. * @stable ICU 2.8 */ int32_t ChineseCalendar::handleGetExtendedYear() { int32_t year; if (newestStamp(UCAL_ERA, UCAL_YEAR, kUnset) <= fStamp[UCAL_EXTENDED_YEAR]) { year = internalGet(UCAL_EXTENDED_YEAR, 1); // Default to year 1 } else { int32_t cycle = internalGet(UCAL_ERA, 1) - 1; // 0-based cycle // adjust to the instance specific epoch year = cycle * 60 + internalGet(UCAL_YEAR, 1) - (fEpochYear - CHINESE_EPOCH_YEAR); } return year; }