Logo Search packages:      
Sourcecode: icu version File versions

int32_t Calendar::computeJulianDay (  )  [protected, inherited]

Compute the Julian day from fields. Will determine whether to use the JULIAN_DAY field directly, or other fields.

the julian day

For internal use only.

Definition at line 2531 of file calendar.cpp.

References Calendar::fStamp, Calendar::getFieldResolutionTable(), Calendar::handleComputeJulianDay(), Calendar::internalGet(), Calendar::newestStamp(), Calendar::resolveFields(), UCAL_DAY_OF_MONTH, UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_ERA, UCAL_EXTENDED_YEAR, UCAL_JULIAN_DAY, and UCAL_YEAR_WOY.

Referenced by Calendar::computeTime().

    // We want to see if any of the date fields is newer than the
    // JULIAN_DAY.  If not, then we use JULIAN_DAY.  If so, then we do
    // the normal resolution.  We only use JULIAN_DAY if it has been
    // set by the user.  This makes it possible for the caller to set
    // the calendar to a time and call clear(MONTH) to reset the MONTH
    // to January.  This is legacy behavior.  Without this,
    // clear(MONTH) has no effect, since the internally set JULIAN_DAY
    // is used.
    if (fStamp[UCAL_JULIAN_DAY] >= (int32_t)kMinimumUserStamp) {
        int32_t bestStamp = newestStamp(UCAL_ERA, UCAL_DAY_OF_WEEK_IN_MONTH, kUnset);
        bestStamp = newestStamp(UCAL_YEAR_WOY, UCAL_EXTENDED_YEAR, bestStamp);
        if (bestStamp <= fStamp[UCAL_JULIAN_DAY]) {
            return internalGet(UCAL_JULIAN_DAY);

    UCalendarDateFields bestField = resolveFields(getFieldResolutionTable());
    if (bestField == UCAL_FIELD_COUNT) {
        bestField = UCAL_DAY_OF_MONTH;

    return handleComputeJulianDay(bestField);

Generated by  Doxygen 1.6.0   Back to index