Skip to content

Commit d176906

Browse files
authored
Fix epoch naming (#38)
1 parent 64a90bc commit d176906

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

libsgp4/DateTime.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,14 +626,24 @@ class DateTime
626626
return Util::WrapTwoPI(Util::DegreesToRadians(gt / 240.0));
627627
}
628628

629+
/**
630+
* Return the modified julian date since the j1900 epoch
631+
* January 1, 1900, at 12:00 TT
632+
* @returns the modified julian date
633+
*/
634+
double ToJ1900() const
635+
{
636+
return ToJulian() - 2415020.0;
637+
}
638+
629639
/**
630640
* Return the modified julian date since the j2000 epoch
631641
* January 1, 2000, at 12:00 TT
632642
* @returns the modified julian date
633643
*/
634644
double ToJ2000() const
635645
{
636-
return ToJulian() - 2415020.0;
646+
return ToJulian() - 2451545.0;
637647
}
638648

639649
/**

libsgp4/SGP4.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ void SGP4::DeepSpaceInitialise(
721721
/*
722722
* initialize lunar / solar terms
723723
*/
724-
const double jday = elements_.Epoch().ToJ2000();
724+
const double jday = elements_.Epoch().ToJ1900();
725725

726726
const double xnodce = Util::WrapTwoPI(4.5236020 - 9.2422029e-4 * jday);
727727
const double stem = sin(xnodce);

libsgp4/SolarPosition.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace libsgp4
2727

2828
Eci SolarPosition::FindPosition(const DateTime& dt)
2929
{
30-
const double mjd = dt.ToJ2000();
30+
const double mjd = dt.ToJ1900();
3131
const double year = 1900 + mjd / 365.25;
3232
const double T = (mjd + Delta_ET(year) / kSECONDS_PER_DAY) / 36525.0;
3333
const double M = Util::DegreesToRadians(Util::Wrap360(358.47583

0 commit comments

Comments
 (0)