diff options
authorAkarsh Simha <[email protected]>2016-09-27 21:08:14 -0500
committerAkarsh Simha <[email protected]>2016-09-28 06:54:01 -0500
commit90e7e72037b029f61d922ec2fc60e2f9135ec090 (patch)
parent535189077de67e929a19bd9bbaa588f5628aaccc (diff)
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: (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.
1 files changed, 2 insertions, 2 deletions
diff --git a/kstars/time/kstarsdatetime.h b/kstars/time/kstarsdatetime.h
index d89613c..3f227fe 100644
--- a/kstars/time/kstarsdatetime.h
+++ b/kstars/time/kstarsdatetime.h
@@ -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
- 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.