14 const ptime epoch(date(1970,1,1), time_duration(0,0,0,0));
15 unix_time_ = (t - epoch).ticks() /
16 ((double) time_duration::ticks_per_second());
23 Time::operator boost::posix_time::ptime()
const 25 return ptime(date(1970,1,1),
27 floor(unix_time() * time_duration::ticks_per_second() + 0.5)));
40 return pt.date().day_of_year() + pt.time_of_day().total_microseconds() /
54 double frac = double(( pt - ptime(date(pt.date().year(), 1, 1)) ).total_microseconds()) /
55 double(( ptime(date(pt.date().year(), 12, 31)) - ptime(date(pt.date().year(), 1, 1)) ).total_microseconds());
56 return pt.date().year() + frac;
66 std::string tstring(Time_string);
72 if(tstring.find(
'T') != std::string::npos)
73 tstring[tstring.find(
'T')] =
' ';
74 tstring = tstring.substr(0, tstring.find(
'Z'));
75 return Time(boost::posix_time::time_from_string(tstring));
84 std::string t = to_iso_extended_string(ptime(*
this));
Time()
Default constructor.
static Time parse_time(const std::string &Time_string)
Parse CCSDS format time (e.g., "1996-07-03T04:13:57.987654Z")
double frac_year() const
Calculate the fractional year.
std::string to_string() const
Convert to CCSDS format.
double frac_day_of_year() const
Calculate the fractional day of the year.
This is a simple time class.
Contains classes to abstract away details in various Spurr Radiative Transfer software.