Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using own implemented julian date and modifying julian date #181

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions include/boost/astronomy/coordinate/utility/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ file License.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
//Time
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/astronomy/time/time_conversions.hpp>

#include <boost/astronomy/coordinate/coord_sys/coord_sys.hpp>

Expand All @@ -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 {

Expand Down Expand Up @@ -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;

Expand Down
12 changes: 6 additions & 6 deletions include/boost/astronomy/time/time_conversions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;

Expand Down