Commit 791e2042 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

ENH: add GetJulianDay and GetModifiedJulianDay methods to TimePoint

parent 7345aadd
......@@ -121,6 +121,12 @@ public:
return lhs.m_Time == rhs.m_Time;
}
/** Return the julian day corresponding to the time point */
double GetJulianDay() const;
/** Return the modified julian day corresponding to the time point */
double GetModifiedJulianDay() const;
friend TimePoint& operator+=(TimePoint & u, Duration const& v);
friend TimePoint& operator-=(TimePoint & u, Duration const& v);
......
......@@ -60,6 +60,16 @@ std::istream & TimePoint::Read(std::istream & is, const std::string & format)
return is;
}
double TimePoint::GetJulianDay() const
{
return (m_Time.time_since_epoch().count() * details::internalPeriod) / 86400.0 + 2440587.5;
}
double TimePoint::GetModifiedJulianDay() const
{
return (m_Time.time_since_epoch().count() * details::internalPeriod) / 86400.0 + 40587;
}
double Duration::TotalSeconds() const
{
return m_Duration.count() * details::internalPeriod;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment