[Marble-commits] KDE/kdeedu/marble/src/lib
John Layt
john at layt.net
Thu Sep 23 11:34:36 CEST 2010
SVN commit 1178598 by jlayt:
Fix Julian Day number handling, don't duplicate what QDate already provides.
See review http://reviewboard.kde.org/r/5374/
D ExtDateTime.cpp
D ExtDateTime.h
M +0 -37 MarbleClock.cpp
M +0 -9 MarbleClock.h
M +2 -2 SunLocator.cpp
--- trunk/KDE/kdeedu/marble/src/lib/MarbleClock.cpp #1178597:1178598
@@ -34,43 +34,6 @@
}
-int MarbleClock::year0() const
-{
- int year = m_datetime.date().year();
- if ( year < 0 )
- year++;
- return year;
-}
-
-
-long MarbleClock::toJulianDayNumber() const
-{
- const int EPOCH_G = 32045; // 29 February 4801BCE in gregorian calendar
- const int EPOCH_J = 32083; // 29 February 4801BCE in julian calendar
-
- int y = year0() + 4800;
- int m = m_datetime.date().month() - 3;
-
- if ( m_datetime.date().month() <= 2 ) {
- y--;
- m += 12;
- }
-
- long jdn = m_datetime.date().day() + ((153*m + 2) / 5) + 365*y + y/4;
-
- if ( jdn >= 2331254 ) {
- // If the date is >= 1582-10-15, then assume gregorian
- // calendar is being used
- jdn += -y/100 + y/400 - EPOCH_G;
- } else {
- // Assume julian calendar is being used.
- jdn -= EPOCH_J;
- }
-
- return jdn;
-}
-
-
qreal MarbleClock::dayFraction() const
{
qreal f;
--- trunk/KDE/kdeedu/marble/src/lib/MarbleClock.h #1178597:1178598
@@ -28,15 +28,6 @@
MarbleClock();
~MarbleClock();
- /**
- * @brief Convert 1BCE to year 0, etc.
- **/
- int year0() const;
-
- /**
- * @brief Convert to julian day number. Adapted from http://en.wikipedia.org/wiki/Julian_day#Calculation
- **/
- long toJulianDayNumber() const;
qreal dayFraction() const;
Q_SIGNALS:
--- trunk/KDE/kdeedu/marble/src/lib/SunLocator.cpp #1178597:1178598
@@ -88,7 +88,7 @@
{
if( d->m_planet->id() == "moon" ) {
// days since the first full moon of the 20th century
- qreal days = (qreal)d->m_clock->toJulianDayNumber() + d->m_clock->dayFraction() - MOON_EPOCH;
+ qreal days = (qreal)d->m_clock->dateTime().date().toJulianDay() + d->m_clock->dayFraction() - MOON_EPOCH;
// number of orbits the moon has made (relative to the sun as observed from earth)
days /= MOON_SYNODIC_PERIOD;
@@ -112,7 +112,7 @@
}
// find current Julian day number relative to epoch J2000
- long day = d->m_clock->toJulianDayNumber() - J2000;
+ long day = d->m_clock->dateTime().date().toJulianDay() - J2000;
// from http://www.astro.uu.nl/~strous/AA/en/reken/zonpositie.html
// mean anomaly
More information about the Marble-commits
mailing list