summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-09-28 02:08:14 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-09-28 11:54:01 (GMT)
commit90e7e72037b029f61d922ec2fc60e2f9135ec090 (patch)
tree30768b330d7fa0b8ff8590f7c5524ab11bd69aad
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: 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.
-rw-r--r--kstars/time/kstarsdatetime.h4
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 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.