4 #include <boost/operators.hpp> 5 #include <boost/date_time/posix_time/posix_time.hpp> 30 private boost::less_than_comparable<Time>,
31 private boost::equality_comparable<Time>,
32 private boost::addable<Time, double>,
33 private boost::subtractable<Time, double> {
42 Time(
const boost::posix_time::ptime& t);
43 operator boost::posix_time::ptime()
const;
57 {
Time res; res.unix_time_ = pgs + 725846400.0;
return res;}
64 {
Time res; res.unix_time_ = iet - 378691200.0;
return res;}
88 double pgs_time()
const {
return unix_time_ - 725846400.0;}
94 double iet_time()
const {
return unix_time_ + 378691200.0;}
Time()
Default constructor.
static Time parse_time(const std::string &Time_string)
Parse CCSDS format time (e.g., "1996-07-03T04:13:57.987654Z")
static Time time_iet(double iet)
Return time from given IDPS Epoch Time (IET) (epoch of 1958-01-01).
double pgs_time() const
Give time in PGS toolkit time, as a double (epoch 1993-01-01)
double frac_year() const
Calculate the fractional year.
double iet_time() const
Give time in IDPS Epoch Time (IET) time, as double (epoch 1958-01-01)
double operator-(const Time &T1, const Time &T2)
Subtract two Times, giving the interval between them in seconds.
This is a Mixin for classes that can be printed.
Time & operator+=(double T)
Add given number of seconds to Time.
std::string to_string() const
Convert to CCSDS format.
double frac_day_of_year() const
Calculate the fractional day of the year.
void print(std::ostream &os) const
Print to stream.
This is a simple time class.
Contains classes to abstract away details in various Spurr Radiative Transfer software.
bool operator<(const FullPhysics::DoubleWithUnit &A, const FullPhysics::DoubleWithUnit &B)
static Time time_pgs(double pgs)
Return time from given PGS toolkit time (epoch of 1993-01-01).
Time & operator-=(double T)
Subtract given number of seconds to Time.
static Time time_unix(double unix_time)
Return time from given Unix time (epoch of 1970-01-01).
bool operator==(const FullPhysics::DoubleWithUnit &A, const FullPhysics::DoubleWithUnit &B)
We define != in terms of this operator.
double unix_time() const
Give time in unix time, as a double (epoch 1970-01-01)