41 DateTime(
int yy,
int mm,
int dd,
int hh,
int mn,
int ss);
44 DateTime(
int yy,
int mm,
int dd,
int hh,
int mn,
double ss);
47 DateTime(
int yy,
int mm,
int dd,
int hh,
int mn,
int ss,
double ff);
56 void _init(
int yy,
int mm,
int dd,
int hh,
int mn,
int ss,
double ff);
57 void _normalize_time();
58 void _normalize_date();
62 explicit operator std::string()
const {
return isoformat(); }
65 bool operator<(
const DateTime &ts)
const;
66 bool operator>(
const DateTime &ts)
const;
67 bool operator<=(
const DateTime &ts)
const;
68 bool operator>=(
const DateTime &ts)
const;
69 bool operator==(
const DateTime &ts)
const;
70 bool operator!=(
const DateTime &ts)
const;
74 DateTime& operator=(
const std::string &);
75 DateTime& operator+=(
const TimeDelta& ts);
76 DateTime& operator+=(
const double& s);
77 DateTime& operator-=(
const TimeDelta& ts);
78 DateTime& operator-=(
const double& s);
80 DateTime operator+(
const TimeDelta& ts)
const;
81 DateTime operator+(
const double& s)
const;
82 DateTime operator-(
const TimeDelta& ts)
const;
83 DateTime operator-(
const double& s)
const;
85 TimeDelta operator-(
const DateTime& ts)
const;
121 void strptime(
const std::string &,
const std::string & sep =
"T");
128 std::ostream & operator<<(std::ostream &,
const DateTime &);
131 const DateTime MIN_DATE_TIME = DateTime(1970, 1, 1);
132 const std::string UNINITIALIZED_STRING =
"uninitialized";
134 static const int DaysInMonths[] = {31,28,31,
139 static const int DaysBeforeMonths[] = {0,31,59,
143 static const int DAY_TO_YEAR = 365;
144 static const int DAYSPER100 = 36524;
145 static const int DAYSPER400 = 146097;
146 static const int DAYSPER4 = 1461;
147 static const int MAXORDINAL = 3652059;
149 static const double TOL_SECONDS = 1e-10;
153 int _days_in_month(
int,
int);
154 int _days_before_year(
int);
155 int _days_before_month(
int,
int);
156 int _ymd_to_ord(
int,
int,
int);
157 void _ord_to_ymd(
int,
int &,
int &,
int &);
double secondsOfDay() const
Return seconds of day.
Definition: DateTime.cpp:418
Data structure to store date time to nano-sec precision.
Definition: DateTime.h:18
std::string isoformat() const
Return date formatted as ISO-8601 string.
Definition: DateTime.cpp:452
bool isClose(const DateTime &ts) const
Check whether two DateTimes are equivalent to within TOL_SECONDS.
Definition: DateTime.cpp:403
DateTime()
Default constructor.
Definition: DateTime.h:32
double ordinal() const
Return ordinal - time since GPS time origin.
int dayOfWeek() const
Return day of week.
void strptime(const std::string &, const std::string &sep="T")
Parse a given string in ISO-8601 format.
Definition: DateTime.cpp:467
double secondsSinceEpoch() const
Return ordinal - time since GPS time origin.
Definition: DateTime.cpp:438
int dayOfYear() const
Return day of year.