JulianDate::DateDecomposition JulianDate::getDecomposition() const {
    const int D4 = 365 * 4 + 1;
    const int D1 = 365;

    const int d = mod_julian_day() - JULIAN_DAY_ZERO_MJD_OFFSET;

    const int c4 = d / D4;
    const int d4 = d % D4;

    const int cp1 = std::min(d4 / (D1 + 1), 1);
    const int dp1 = d4 - cp1 * (D1 + 1);
    const int cb1 = cp1 * dp1 / D1;
    const int db1 = dp1 - cb1 * D1;

    return DateDecomposition{4 * c4 + cp1 + cb1, db1};
  }
Exemple #2
0
	int Date::operator-(const Date & d) const
	{
		return mod_julian_day() - d.mod_julian_day();
	}
Exemple #3
0
	bool Date::operator<(const Date & d) const
	{
		return mod_julian_day() < d.mod_julian_day();
	}
Exemple #4
0
	bool Date::operator>=(const Date & d) const
	{
		return mod_julian_day() >= d.mod_julian_day();
	}
Exemple #5
0
	Julian::Julian(const Date & date) : GreLian(date)
	{
		int diff = mod_julian_day() - date.mod_julian_day();
		*this -= diff;
	}
Exemple #6
0
	Julian::Julian(Date* & dp) : GreLian(*dp)
	{
		int diff = mod_julian_day() - dp->mod_julian_day();
		*this -= diff;
	}
Exemple #7
0
lab2::Gregorian::Gregorian(const lab2::Date &date) {
    _year = date.year();
    _month = date.month();
    _day = date.day();
    *this += date.mod_julian_day()-mod_julian_day();
}
Exemple #8
0
unsigned int WesternDate::week_day() const {
    int wd = (mod_julian_day()+ 2) % wkds.size();
    ++wd;
    return wd;
}
Exemple #9
0
 		int Date::operator -(const Date & d) const{
 			int diff = mod_julian_day() - d.mod_julian_day();
 			/*if (diff < 0)
 				return diff * -1;*/
 			return diff;
 		}		
Exemple #10
0
	bool Date::operator<=(const Date &date) const {
		return mod_julian_day() <= date.mod_julian_day();
	}
Exemple #11
0
const bool Date::operator>(const Date& d) const{
	return (mod_julian_day() > d.mod_julian_day());
}