return (
getJDEpochOffset() // difference from Julian epoch to 1,1,1
+ 365LL * year64 // number of days from years
+ ClockMath::floorDivideInt64(year64, 4LL) // extra day of leap year
+ 30 * emonth // number of days from months (months are 0-based)
- 1// number of days for present month (1 based)
);
}
//------------------------------------------------------------------------- // Calendar system Conversion methods... //-------------------------------------------------------------------------
namespace { void jdToCE(int32_t julianDay, int32_t jdEpochOffset, int32_t& year, int32_t& month, int32_t& day, int32_t& doy, UErrorCode& status)
{
int32_t c4; // number of 4 year cycle (1461 days)
int32_t r4; // remainder of 4 year cycle, always positive
if (uprv_add32_overflow(julianDay, -jdEpochOffset, &julianDay)) {
status = U_ILLEGAL_ARGUMENT_ERROR; return;
}
c4 = ClockMath::floorDivide(julianDay, 1461, &r4);
year = 4 * c4 + (r4/365 - r4/1460); // 4 * <number of 4year cycle> + <years within the last cycle>
doy = (r4 == 1460) ? 365 : (r4 % 365); // days in present year
month = doy / 30; // 30 -> Coptic/Ethiopic month length up to 12th month
day = (doy % 30) + 1; // 1-based days in a month
doy++; // 1-based days in a year.
}
} // namespace
void
CECalendar::handleComputeFields(int32_t julianDay, UErrorCode& status)
{
int32_t eyear, month, day, doy;
jdToCE(julianDay, getJDEpochOffset(), eyear, month, day, doy, status); if (U_FAILURE(status)) return;
int32_t era = extendedYearToEra(eyear);
int32_t year = extendedYearToYear(eyear);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.