Beispiel #1
0
	Julian operator+(Julian const & j, detail::packaged_year y) {
		year_t year = j.year() + static_cast<year_t>(y.nYears_);
		return Julian(
			year, j.month(),
			j.month() == 2 && j.day() == 29 && !is_julian_leapyear(year) ?
			28 : j.day(), j.hour(), j.minute(), j.second());
	}
Beispiel #2
0
	Julian operator-(Julian const & j, detail::packaged_month m) {
		year_t year = j.year() - m.nMonths_ / 12;
		month_t month = j.month() - m.nMonths_ % 12;
		double adjust = (month - 1) / 12 + (month - 12) / 12;
		year += static_cast<year_t>(adjust);
		month -= static_cast<month_t>(adjust * 12);
		day_t day = j.day() < julian_days_in_month(month, is_julian_leapyear(year)) ?
			j.day() : julian_days_in_month(month, is_julian_leapyear(year));
		return Julian(year, month, day, j.hour(), j.minute(), j.second());
	}