|
LSSTApplications
1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
LSSTDataManagementBasePackage
|
Class for handling dates/times, including MJD, UTC, and TAI. More...
#include <DateTime.h>
Public Types | |
| enum | Timescale { TAI, UTC, TT } |
| enum | DateSystem { JD, MJD, EPOCH } |
Public Member Functions | |
| DateTime (long long nsecs=0LL, Timescale scale=TAI) | |
| DateTime (double date, DateSystem system=MJD, Timescale scale=TAI) | |
| DateTime (int year, int month, int day, int hr, int min, int sec, Timescale scale=TAI) | |
| DateTime (std::string const &iso8601) | |
| long long | nsecs (Timescale scale=TAI) const |
| double | mjd (Timescale scale=TAI) const |
| double | get (DateSystem system=MJD, Timescale scale=TAI) const |
| std::string | toString (void) const |
| struct tm | gmtime (void) const |
| struct timespec | timespec (void) const |
| struct timeval | timeval (void) const |
| bool | operator== (DateTime const &rhs) const |
Static Public Member Functions | |
| static DateTime | now (void) |
| static void | initializeLeapSeconds (std::string const &leapString) |
Private Member Functions | |
| double | _getMjd (Timescale scale) const |
| double | _getJd (Timescale scale) const |
| double | _getEpoch (Timescale scale) const |
| void | setNsecsFromMjd (double mjd, Timescale scale) |
| a function to convert MJD to interal nsecs More... | |
| void | setNsecsFromJd (double jd, Timescale scale) |
| a function to convert JD to internal nsecs More... | |
| void | setNsecsFromEpoch (double epoch, Timescale scale) |
| a function to convert epoch to internal nsecs More... | |
| template<class Archive > | |
| void | serialize (Archive ar, int const version) |
Private Attributes | |
| long long | _nsecs |
| Nanoseconds since Unix epoch. More... | |
Friends | |
| class | boost::serialization::access |
Class for handling dates/times, including MJD, UTC, and TAI.
Definition at line 58 of file DateTime.h.
| Enumerator | |
|---|---|
| JD | |
| MJD | |
| EPOCH | |
Definition at line 61 of file DateTime.h.
| Enumerator | |
|---|---|
| TAI | |
| UTC | |
| TT | |
Definition at line 60 of file DateTime.h.
Constructor.
| [in] | nsecs | Number of nanoseconds since the epoch. |
| [in] | scale | Timescale of input (TAI or UTC, default TAI). |
Definition at line 290 of file DateTime.cc.
|
explicit |
Constructor.
| [in] | date | Date. |
| [in] | system | The requested date system (JD, MJD, or Julian epoch) |
| [in] | scale | Timescale of input (TAI or UTC, default TAI). |
Definition at line 303 of file DateTime.cc.
| lsst.daf.base::DateTime::DateTime | ( | int | year, |
| int | month, | ||
| int | day, | ||
| int | hr, | ||
| int | min, | ||
| int | sec, | ||
| Timescale | scale = TAI |
||
| ) |
Constructor.
| [in] | year | Year number. |
| [in] | month | Month number (Jan = 1). |
| [in] | day | Day number (1 to 31). |
| [in] | hr | Hour number (0 to 23). |
| [in] | min | Minute number (0 to 59). |
| [in] | sec | Second number (0 to 60). |
| [in] | scale | Timescale of input (TAI or UTC, default TAI). |
Definition at line 331 of file DateTime.cc.
|
explicit |
Constructor. Accepts a restricted subset of ISO8601: yyyy-mm-ddThh:mm:ss.nnnnnnnnnZ where the - and : separators are optional, the fractional seconds are also optional, and the decimal point may be a comma.
| [in] | iso8601 | ISO8601 representation of date and time. Must be UTC. |
Definition at line 381 of file DateTime.cc.
|
private |
Convert to Julian Epoch.
| [in] | scale | Desired timescale (TAI or UTC, default TAI). |
Definition at line 481 of file DateTime.cc.
|
private |
Convert to Julian Day.
| [in] | scale | Desired timescale (TAI or UTC, default TAI). |
Definition at line 473 of file DateTime.cc.
|
private |
Convert to Modified Julian Day.
| [in] | scale | Desired timescale (TAI or UTC, default TAI). |
Definition at line 455 of file DateTime.cc.
| double lsst.daf.base::DateTime::get | ( | DateSystem | system = MJD, |
| Timescale | scale = TAI |
||
| ) | const |
Generic Accessor
| [in] | system | The type of date requested (JD, MJD, or EPOCH) |
| [in] | scale | The time scale (UTC, or TAI) |
Definition at line 418 of file DateTime.cc.
| struct tm lsst.daf.base::DateTime::gmtime | ( | void | ) | const |
Convert to struct tm. Truncate fractional seconds.
Definition at line 491 of file DateTime.cc.
|
static |
Initialize leap second table.
| leapString | Leap second table from USNO as a single multiline string. |
Definition at line 567 of file DateTime.cc.
Definition at line 69 of file DateTime.h.
|
static |
Return current time as a DateTime.
Definition at line 553 of file DateTime.cc.
Accessor.
Definition at line 440 of file DateTime.cc.
| bool lsst.daf.base::DateTime::operator== | ( | DateTime const & | rhs | ) | const |
Equality operator.
Definition at line 546 of file DateTime.cc.
|
inlineprivate |
Serialize DateTime to/from a Boost archive.
| [in,out] | ar | Archive to access. |
| [in] | version | Version of class serializer. |
Definition at line 101 of file DateTime.h.
|
private |
a function to convert epoch to internal nsecs
| [in] | epoch | The Julian epoch |
| [in] | scale | The time scale (TAI, or UTC) |
Definition at line 280 of file DateTime.cc.
|
private |
a function to convert JD to internal nsecs
| [in] | jd | The Julian Day |
| [in] | scale | The time scale (TAI, or UTC) |
Definition at line 271 of file DateTime.cc.
|
private |
a function to convert MJD to interal nsecs
| [in] | mjd | The Modified Julian Day |
| [in] | scale | The time scale (TAI, or UTC) |
Definition at line 245 of file DateTime.cc.
| struct timespec lsst.daf.base::DateTime::timespec | ( | void | ) | const |
Convert to struct timespec.
Definition at line 510 of file DateTime.cc.
| struct timeval lsst.daf.base::DateTime::timeval | ( | void | ) | const |
Convert time to struct timeval.
Definition at line 521 of file DateTime.cc.
| std::string lsst.daf.base::DateTime::toString | ( | void | ) | const |
Accessor.
Definition at line 532 of file DateTime.cc.
|
friend |
Definition at line 96 of file DateTime.h.
|
private |
Nanoseconds since Unix epoch.
Definition at line 86 of file DateTime.h.
1.8.5