|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
Time stored as two 32-bit words: seconds (high word) and nanoseconds (low word). More...
#include <TimeStamp.hh>
Public Member Functions | |
| TimeStamp () | |
| Default constructor; both words are left uninitialized. | |
| TimeStamp (const TimeStamp &t) | |
| Copy both words of t. | |
| TimeStamp (const ::timespec &ts) | |
| Set seconds from ts.tv_sec and nanoseconds from ts.tv_nsec. | |
| TimeStamp (double sec) | |
| Split sec into whole seconds and a fraction; nanoseconds = (unsigned)(1e9 * fraction + 0.5). | |
| TimeStamp (unsigned sec, unsigned nsec) | |
| Set seconds to sec and nanoseconds to nsec (not normalized). | |
| TimeStamp (uint64_t stamp) | |
| Set nanoseconds to bits 31:0 of stamp and seconds to bits 63:32 (the inverse of value()). | |
| uint64_t | value () const |
| Return (seconds << 32) | nanoseconds. | |
| unsigned | seconds () const |
| Return the seconds (high) word. | |
| unsigned | nanoseconds () const |
| Return the nanoseconds (low) word. | |
| double | asDouble () const |
| Return seconds + nanoseconds / 1e9. | |
| bool | isZero () const |
| Return true if both words are 0. | |
| uint64_t | to_ns () const |
| Return seconds * 1000000000 + nanoseconds. | |
| TimeStamp & | from_ns (uint64_t nsec) |
| Set seconds to nsec / 1000000000 (truncated to 32 bits) and nanoseconds to nsec % 1000000000. | |
| TimeStamp & | operator= (const TimeStamp &) |
| Copy both words. | |
| bool | operator> (const TimeStamp &) const |
| Return true if this time is later: compares seconds, then nanoseconds. | |
| bool | operator== (const TimeStamp &) const |
| Return true if both words are equal. | |
Time stored as two 32-bit words: seconds (high word) and nanoseconds (low word).
value() returns them packed as (seconds << 32) | nanoseconds.
|
inline |
Default constructor; both words are left uninitialized.
| XtcData::TimeStamp::TimeStamp | ( | const ::timespec & | ts | ) |
Set seconds from ts.tv_sec and nanoseconds from ts.tv_nsec.
| XtcData::TimeStamp::TimeStamp | ( | double | sec | ) |
Split sec into whole seconds and a fraction; nanoseconds = (unsigned)(1e9 * fraction + 0.5).
Set seconds to sec and nanoseconds to nsec (not normalized).
|
inline |
Set nanoseconds to bits 31:0 of stamp and seconds to bits 63:32 (the inverse of value()).
|
inline |
Return seconds + nanoseconds / 1e9.
|
inline |
Set seconds to nsec / 1000000000 (truncated to 32 bits) and nanoseconds to nsec % 1000000000.
|
inline |
Return true if both words are 0.
|
inline |
Return the nanoseconds (low) word.
Return true if both words are equal.
Return true if this time is later: compares seconds, then nanoseconds.
|
inline |
Return the seconds (high) word.
|
inline |
Return seconds * 1000000000 + nanoseconds.
|
inline |
Return (seconds << 32) | nanoseconds.