-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
780ac79
commit b6e0524
Showing
10 changed files
with
79 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
#include "dtfund.hpp" | ||
|
||
namespace { | ||
/** avoid magic numbers */ | ||
constexpr const int DAYS_IN_YEAR = 365; | ||
} /* unnamed namespace */ | ||
|
||
dso::ydoy_date dso::modified_julian_day::to_ydoy() const noexcept { | ||
const long days_fr_jan1_1901 = m_mjd - dso::JAN11901; | ||
const long num_four_yrs = days_fr_jan1_1901 / 1461L; | ||
const long years_so_far = 1901L + 4 * num_four_yrs; | ||
const long days_left = days_fr_jan1_1901 - 1461 * num_four_yrs; | ||
const long delta_yrs = days_left / 365 - days_left / 1460; | ||
const int days_fr_jan1_1901 = m_mjd - dso::JAN11901; | ||
const int num_four_yrs = days_fr_jan1_1901 / 1461; | ||
const int years_so_far = 1901 + 4 * num_four_yrs; | ||
const int days_left = days_fr_jan1_1901 - 1461 * num_four_yrs; | ||
const int delta_yrs = days_left / DAYS_IN_YEAR - days_left / 1460; | ||
|
||
return dso::ydoy_date(dso::year(years_so_far + delta_yrs), | ||
dso::day_of_year(days_left - 365 * delta_yrs + 1)); | ||
return {dso::year(years_so_far + delta_yrs), | ||
dso::day_of_year(days_left - DAYS_IN_YEAR * delta_yrs + 1)}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
#include "tpdate.hpp" | ||
|
||
dso::TwoPartDate dso::TwoPartDateUTC::utc2tai() const noexcept { | ||
FDOUBLE taisec; | ||
FDOUBLE taisec=0e0; | ||
int taimjd = this->utc2tai(taisec); | ||
return dso::TwoPartDate(taimjd, dso::FractionalSeconds{taisec}); | ||
} | ||
|
||
dso::TwoPartDate dso::TwoPartDateUTC::utc2tt() const noexcept { | ||
FDOUBLE ttsec; | ||
FDOUBLE ttsec=0e0; | ||
int ttmjd = this->utc2tai(ttsec); | ||
return dso::TwoPartDate(ttmjd, dso::FractionalSeconds{ttsec}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters