Commit 90e7e720 authored by Akarsh Simha's avatar Akarsh Simha

Fix the definition of Julian Epoch in KStarsDateTime

Since epochs are a measure of uniform flow of time, they cannot be
affected by leap years etc.

The peer-reviewed definition of Julian Epoch that this patch uses
comes from Eric Weisstein's World of Science:
http://scienceworld.wolfram.com/astronomy/JulianEpoch.html

(This definition may also be found on Wikipedia). The constant
2451545.0 is identical with the #define J2000 -- i.e. the Julian date
corresponding to the J2000.0 epoch.
parent 53518907
......@@ -158,9 +158,9 @@ public:
*@return the epoch value of the Date/Time.
*@note the epoch is shorthand for the date, expressed as a floating-point year value.
*@sa setFromEpoch()
*@note The definition of Julian Epoch used here comes from http://scienceworld.wolfram.com/astronomy/JulianEpoch.html
*/
inline double epoch() const { return ( double( date().year() )
+ double( date().dayOfYear() )/double( date().daysInYear() ) ); }
inline double epoch() const { return 2000.0 + (djd() - J2000)/365.25; }
/**
*Set the Date/Time from an epoch value, represented as a double.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment