49bool QMilankovicCalendar::isLeapYear(
int year)
const
51 if (year == QCalendar::Unspecified)
57 const auto yeardm = qDivMod<100>(year);
58 if (yeardm.remainder == 0) {
59 const qint16 century = qMod<9>(yeardm.quotient);
60 if (century != 2 && century != 6)
74bool QMilankovicCalendar::dateToJulianDay(
int year,
int month,
int day, qint64 *jd)
const
77 if (!isDateValid(year, month, day))
80 const auto yearDays = yearMonthToYearDays(year, month);
81 const auto centuryYear = qDivMod<100>(yearDays.year);
82 const qint64 fromYear = qDiv<9>(NineCenturies * centuryYear.quotient + 6)
83 + qDiv<100>(LeapCentury * centuryYear.remainder);
84 *jd = fromYear + yearDays.days + day + MilankovicBaseJd;
88QCalendar::YearMonthDay QMilankovicCalendar::julianDayToDate(qint64 jd)
const
90 const auto century9Day = qDivMod<NineCenturies>(9 * (jd - MilankovicBaseJd) - 7);
92 const auto year100Day = qDivMod<LeapCentury>(100 * qDiv<9>(century9Day.remainder) + 99);
94 const auto ymd = dayInYearToYmd(qDiv<100>(year100Day.remainder));
95 const int y = 100 * century9Day.quotient + year100Day.quotient + ymd.year;
96 return QCalendar::YearMonthDay(y > 0 ? y : y - 1, ymd.month, ymd.day);