25 #ifndef LSST_DAF_BASE_DATETIME_H
26 #define LSST_DAF_BASE_DATETIME_H
50 #include "lsst/pex/exceptions.h"
54 namespace serialization {
68 constexpr
static long long invalid_nsecs = std::numeric_limits<std::int64_t>::min();
220 void _assertValid()
const {
222 throw LSST_EXCEPT(pex::exceptions::RuntimeError,
"DateTime not valid");
260 void setNsecsFromMjd(
double mjd,
Timescale scale);
269 void setNsecsFromJd(
double jd,
Timescale scale);
278 void setNsecsFromEpoch(
double epoch,
Timescale scale);
288 template <
class Archive>
void serialize(Archive ar,
int const version) {
struct timeval timeval(Timescale scale) const
Get date as a timeval struct, with time in seconds and microseconds.
Class for handling dates/times, including MJD, UTC, and TAI.
bool isValid() const
Is this date valid?
bool operator==(DateTime const &rhs) const
static void initializeLeapSeconds(std::string const &leapString)
Initialize the leap second table from USNO.
struct tm gmtime(Timescale scale) const
Get date as a tm struct, with truncated fractional seconds.
long long nsecs(Timescale scale=TAI) const
Get date as nanoseconds since the unix epoch.
static DateTime now(void)
Return current time as a DateTime.
static constexpr long long invalid_nsecs
DateTime()
Default constructor: construct an invalid DateTime.
struct timespec timespec(Timescale scale) const
Get date as a timespec struct, with time in seconds and nanoseconds.
friend class boost::serialization::access
std::string toString(Timescale scale) const
Get date as an ISO8601-formatted string.