Logo Search packages:      
Sourcecode: icu version File versions

double Grego::fieldsToDay ( int32_t  year,
int32_t  month,
int32_t  dom 
) [static]

Convert a year, month, and day-of-month, given in the proleptic Gregorian calendar, to 1970 epoch days.

Parameters:
year Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
month 0-based month, with 0==Jan
dom 1-based day of month
Returns:
the day number, with day 0 == Jan 1 1970

Definition at line 85 of file gregoimp.cpp.

References ClockMath::floorDivide(), and isLeapYear().

Referenced by RuleBasedTimeZone::getOffset(), OlsonTimeZone::getOffset(), AnnualTimeZoneRule::getStartInYear(), OlsonTimeZone::OlsonTimeZone(), OlsonTimeZone::useDaylightTime(), and ChineseCalendar::winterSolstice().

                                                                  {

    int32_t y = year - 1;

    double julian = 365 * y + ClockMath::floorDivide(y, 4) + (JULIAN_1_CE - 3) + // Julian cal
        ClockMath::floorDivide(y, 400) - ClockMath::floorDivide(y, 100) + 2 + // => Gregorian cal
        DAYS_BEFORE[month + (isLeapYear(year) ? 12 : 0)] + dom; // => month/dom

    return julian - JULIAN_1970_CE; // JD => epoch day
}


Generated by  Doxygen 1.6.0   Back to index