#include <Duration.h>
This software was developed for the LCLS project. If you use all or part of it, please give an appropriate acknowledgment.
Definition at line 41 of file Duration.h.
Definition at line 44 of file Duration.h.
PSTime::Duration::Duration | ( | ) |
Default constructor
Definition at line 42 of file Duration.cpp.
PSTime::Duration::Duration | ( | const Duration & | d | ) |
Copy constructor
Definition at line 47 of file Duration.cpp.
PSTime::Duration::Duration | ( | time_t | sec, | |
time_t | nsec = 0 | |||
) |
Constructs from seconds and nanoseconds
Definition at line 52 of file Duration.cpp.
References nsecInASec.
PSTime::Duration::Duration | ( | time_t | Years, | |
time_t | Days, | |||
time_t | Hours, | |||
time_t | Mins = 0 , |
|||
time_t | Secs = 0 , |
|||
time_t | Nsecs = 0 | |||
) |
Constructs from human numbers In this implementation I ignore monthes, because they may have ambigous number of days 30 or 31. The same problem exists for years 364 or 365 days, though I hope that so long duration is not very practical in our applications.
Definition at line 68 of file Duration.cpp.
virtual PSTime::Duration::~Duration | ( | ) | [inline, virtual] |
Destructor
Definition at line 81 of file Duration.h.
time_t PSTime::Duration::getNsec | ( | ) | const [inline] |
Definition at line 124 of file Duration.h.
Referenced by PSTime::Time::operator+=(), and PSTime::Time::operator-=().
time_t PSTime::Duration::getSec | ( | ) | const [inline] |
Selectors
Definition at line 123 of file Duration.h.
Referenced by PSTime::Time::operator+=(), and PSTime::Time::operator-=().
bool PSTime::Duration::operator!= | ( | const Duration & | d | ) | const [inline] |
Definition at line 97 of file Duration.h.
bool PSTime::Duration::operator< | ( | const Duration & | d | ) | const [inline] |
bool PSTime::Duration::operator<= | ( | const Duration & | d | ) | const [inline] |
Definition at line 112 of file Duration.h.
bool PSTime::Duration::operator== | ( | const Duration & | d | ) | const [inline] |
bool PSTime::Duration::operator> | ( | const Duration & | d | ) | const [inline] |
bool PSTime::Duration::operator>= | ( | const Duration & | d | ) | const [inline] |
Definition at line 117 of file Duration.h.
int PSTime::Duration::parseStringToDuration | ( | const std::string & | str_dur, | |
Duration & | d | |||
) | [static] |
The parsification engine, the string in standard format P[nY][nM][nD][T[nH][nM][n[.f]S]] is parsed in the Duration object. Note, we assume that the monnth M has 30 days..., so it is better to escape this ambiguity using any number of days D. Also note that seconds S may be fractional: n[.f]S, that is beyond the ISO8601 standard.
Definition at line 250 of file Duration.cpp.
References DURATION_STRING_TOO_LONG, DURATION_STRING_TOO_SHORT, DURATION_STRING_WRONG_FORMAT_MISSING_P, DURATION_TOO_LONG_FIELD_FOR_DAYS, DURATION_TOO_LONG_FIELD_FOR_HOURS, DURATION_TOO_LONG_FIELD_FOR_MINUTES, DURATION_TOO_LONG_FIELD_FOR_MONTHS, DURATION_TOO_LONG_FIELD_FOR_SECOND_FRACTION, DURATION_TOO_LONG_FIELD_FOR_SECONDS, DURATION_TOO_LONG_FIELD_FOR_YEARS, m_nsec, m_sec, and PARSE_IS_OK.
void PSTime::Duration::Print | ( | ) | const |
Public methods
Definition at line 180 of file Duration.cpp.
References splitDurationSecsForYDHMS(), and strDurationBasic().
void PSTime::Duration::splitDurationSecsForYDHMS | ( | time_t & | Years, | |
time_t & | DaysAfterY, | |||
time_t & | HoursAfterD, | |||
time_t & | MinsAfterH, | |||
time_t & | SecsAfterM | |||
) | const |
Splits the Duration object entity for Years, DaysAfterY, HoursAfterD, MinsAfterH, SecsAfterM Note, the month are not used because of 28,29,30,31 days ambiguity.
Definition at line 379 of file Duration.cpp.
Referenced by Print(), and strDurationBasic().
string PSTime::Duration::strDurationBasic | ( | ) | const |
Makes the duration string in the format: PnYnMnDTnHnMnS from the object entity.
Definition at line 213 of file Duration.cpp.
References splitDurationSecsForYDHMS().
Referenced by Print().
std::ostream& operator<< | ( | std::ostream & | os, | |
const Duration & | d | |||
) | [friend] |
Friends
Definition at line 401 of file Duration.cpp.