From 872d59b52d75c5768a939216ee31d2cd283f24ac Mon Sep 17 00:00:00 2001 From: Divyam Singal Date: Thu, 24 Dec 2020 22:59:28 +0530 Subject: [PATCH] Using own implemented julian_date() and modifying julian_date() to take imput as date --- .../boost/astronomy/coordinate/utility/utility.hpp | 9 +++++---- include/boost/astronomy/time/time_conversions.hpp | 12 ++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/boost/astronomy/coordinate/utility/utility.hpp b/include/boost/astronomy/coordinate/utility/utility.hpp index 685066c8..1d1afb22 100644 --- a/include/boost/astronomy/coordinate/utility/utility.hpp +++ b/include/boost/astronomy/coordinate/utility/utility.hpp @@ -25,6 +25,7 @@ file License.txt or copy at https://www.boost.org/LICENSE_1_0.txt) //Time #include #include +#include #include @@ -36,7 +37,7 @@ namespace bud = boost::units::degree; using namespace boost::numeric::ublas; namespace bnu = boost::numeric::ublas; -using namespace boost::gregorian; +using namespace boost::astronomy::time; namespace boost { namespace astronomy { namespace coordinate { @@ -309,11 +310,11 @@ struct obliquity_of_ecliptic{ angle_radian e = 0.0 * bu::si::radian; public: - obliquity_of_ecliptic(date d) + obliquity_of_ecliptic(boost::gregorian::date d) { - double julian_date = d.julian_day(); + double JD = julian_date(d); - double modified_julian_date = julian_date - 2451545.0; + double modified_julian_date = JD - 2451545.0; double julian_centuries = modified_julian_date / 36525.0; diff --git a/include/boost/astronomy/time/time_conversions.hpp b/include/boost/astronomy/time/time_conversions.hpp index ca357178..cbe90c7d 100644 --- a/include/boost/astronomy/time/time_conversions.hpp +++ b/include/boost/astronomy/time/time_conversions.hpp @@ -30,11 +30,8 @@ namespace boost { namespace astronomy { namespace time { * made on the Greenwich meridian, longitude 0◦. */ -double julian_date(boost::posix_time::ptime t) -{ - //Get date from UT - boost::gregorian::date dt = t.date(); - +double julian_date(boost::gregorian::date dt) +{ //Set y = year, m = month and d = day double y = dt.year(); double m = dt.month(); @@ -91,8 +88,11 @@ double julian_date(boost::posix_time::ptime t) decimal_hour GST(boost::posix_time::ptime t) { + //Get date from UT + boost::gregorian::date dt = t.date(); + //Get Julian Day Number - double JD = julian_date(t); + double JD = julian_date(dt); double S = JD - 2451545.0;