Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 611e8369f459
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bf23d3da77c0
Choose a head ref
  • 13 commits
  • 5 files changed
  • 1 contributor

Commits on May 6, 2017

  1. Copy the full SHA
    fe2fb38 View commit details
  2. Copy the full SHA
    482fe7b View commit details
  3. MJD without milliseconds.

    pleroy committed May 6, 2017
    Copy the full SHA
    8c44413 View commit details

Commits on May 7, 2017

  1. MJD with milliseconds.

    pleroy committed May 7, 2017
    Copy the full SHA
    033e50b View commit details
  2. Copy the full SHA
    a8ce0c8 View commit details
  3. Period not required.

    pleroy committed May 7, 2017
    Copy the full SHA
    303c9d9 View commit details
  4. Copy the full SHA
    a78359c View commit details
  5. Cleanup.

    pleroy committed May 7, 2017
    Copy the full SHA
    d6ebe31 View commit details
  6. Lint.

    pleroy committed May 7, 2017
    Copy the full SHA
    3450af4 View commit details
  7. After egg's review.

    pleroy committed May 7, 2017
    Copy the full SHA
    6aa4e1a View commit details
  8. After egg's 2nd review.

    pleroy committed May 7, 2017
    Copy the full SHA
    58f7b2a View commit details

Commits on May 8, 2017

  1. The last hair of the yack.

    pleroy committed May 8, 2017
    Copy the full SHA
    cf9e0fa View commit details
  2. Merge pull request #1362 from pleroy/JulianDay

    Parsing of MJD and JD literals
    pleroy authored May 8, 2017
    Copy the full SHA
    bf23d3d View commit details
Showing with 343 additions and 72 deletions.
  1. +25 −9 astronomy/date_time.hpp
  2. +261 −54 astronomy/date_time_body.hpp
  3. +30 −0 astronomy/date_time_test.cpp
  4. +11 −9 astronomy/time_scales_body.hpp
  5. +16 −0 astronomy/time_scales_test.cpp
34 changes: 25 additions & 9 deletions astronomy/date_time.hpp
Original file line number Diff line number Diff line change
@@ -35,14 +35,6 @@ class Date final {

constexpr Date next_day() const;

constexpr bool operator==(Date const& other) const;
constexpr bool operator!=(Date const& other) const;

constexpr bool operator<(Date const& other) const;
constexpr bool operator>(Date const& other) const;
constexpr bool operator<=(Date const& other) const;
constexpr bool operator>=(Date const& other) const;

private:
constexpr Date(int year, int month, int day);

@@ -84,27 +76,51 @@ class DateTime final {

constexpr Date const& date() const;
constexpr Time const& time() const;
// Returns true iff the object was constructed from a JD or MJD string.
constexpr bool jd() const;

// If |time()| is 24:00:00, returns an equivalent DateTime where midnight is
// expressed as 00:00:00 on the next day; otherwise, returns |*this|.
constexpr DateTime normalized_end_of_day() const;

private:
constexpr DateTime(Date date, Time time);
constexpr DateTime(Date date, Time time, bool jd);

// Checks that |time| does not represent a leap second unless |date| is the
// last day of the month.
constexpr DateTime const& checked() const;

Date const date_;
Time const time_;
bool const jd_;

friend constexpr DateTime operator""_DateTime(char const* str,
std::size_t size);
};

constexpr bool operator==(Date const& left, Date const& right);
constexpr bool operator!=(Date const& left, Date const& right);
constexpr bool operator<(Date const& left, Date const& right);
constexpr bool operator>(Date const& left, Date const& right);
constexpr bool operator<=(Date const& left, Date const& right);
constexpr bool operator>=(Date const& left, Date const& right);
constexpr Date operator""_Date(char const* str, std::size_t size);

constexpr bool operator==(Time const& left, Time const& right);
constexpr bool operator!=(Time const& left, Time const& right);
constexpr Time operator""_Time(char const* str, std::size_t size);

constexpr bool operator==(DateTime const& left, DateTime const& right);
constexpr bool operator!=(DateTime const& left, DateTime const& right);

// In addition to ISO 8601, this operator also supports julian dates and
// modified julian dates according to the following formats:
// JDiiii.ffff
// JDiiii
// MJDiiii.ffff
// MJDiiii
// The fractional part ffff must have at most 14 digits. The final result is
// rounded to the nearest millisecond.
constexpr DateTime operator""_DateTime(char const* str, std::size_t size);

} // namespace internal_date_time
Loading