This class represents a time duration with an accuracy of one second. More...
#include <utils.h>
Public Member Functions | |
operator long () const | |
operator string () const | |
bool | operator! () const |
bool | operator!= (const TimePeriod &b) const |
void | operator+= (const TimePeriod &l) |
void | operator-= (const TimePeriod &l) |
bool | operator< (const long &b) const |
bool | operator< (const TimePeriod &b) const |
bool | operator<= (const long &b) const |
bool | operator<= (const TimePeriod &b) const |
bool | operator== (const TimePeriod &b) const |
bool | operator> (const long &b) const |
bool | operator> (const TimePeriod &b) const |
bool | operator>= (const long &b) const |
bool | operator>= (const TimePeriod &b) const |
void | parse (const char *) |
TimePeriod (const long l=0) | |
TimePeriod (const char *s) | |
Static Public Attributes | |
static const TimePeriod | MAX |
static const TimePeriod | MIN |
Friends | |
ostream & | operator<< (ostream &, const TimePeriod &) |
Detailed Description
This class represents a time duration with an accuracy of one second.
The duration can be both positive and negative.
Constructor & Destructor Documentation
frepple::utils::TimePeriod::TimePeriod | ( | const long | l = 0 | ) | [inline] |
frepple::utils::TimePeriod::TimePeriod | ( | const char * | s | ) | [inline] |
Member Function Documentation
frepple::utils::TimePeriod::operator long | ( | ) | const [inline] |
frepple::utils::TimePeriod::operator string | ( | ) | const [inline] |
bool frepple::utils::TimePeriod::operator! | ( | ) | const [inline] |
bool frepple::utils::TimePeriod::operator!= | ( | const TimePeriod & | b | ) | const [inline] |
void frepple::utils::TimePeriod::operator+= | ( | const TimePeriod & | l | ) | [inline] |
void frepple::utils::TimePeriod::operator-= | ( | const TimePeriod & | l | ) | [inline] |
bool frepple::utils::TimePeriod::operator< | ( | const long & | b | ) | const [inline] |
bool frepple::utils::TimePeriod::operator< | ( | const TimePeriod & | b | ) | const [inline] |
bool frepple::utils::TimePeriod::operator<= | ( | const long & | b | ) | const [inline] |
bool frepple::utils::TimePeriod::operator<= | ( | const TimePeriod & | b | ) | const [inline] |
bool frepple::utils::TimePeriod::operator== | ( | const TimePeriod & | b | ) | const [inline] |
bool frepple::utils::TimePeriod::operator> | ( | const long & | b | ) | const [inline] |
bool frepple::utils::TimePeriod::operator> | ( | const TimePeriod & | b | ) | const [inline] |
bool frepple::utils::TimePeriod::operator>= | ( | const long & | b | ) | const [inline] |
bool frepple::utils::TimePeriod::operator>= | ( | const TimePeriod & | b | ) | const [inline] |
void frepple::utils::TimePeriod::parse | ( | const char * | s | ) |
Function that parses a input string to a time value.
The string format is following the ISO 8601 specification for durations: [-]P[nY][nM][nW][nD][T[nH][nM][nS]]
Some examples to illustrate how the string is converted to a timeperiod, expressed in seconds:
P1Y = 1 year = 365 days = 31536000 seconds P1M = 365/12 days = 2628000 seconds P1W = 1 week = 7 days = 604800 seconds -P1D = -1 day = -86400 seconds PT1H = 1 hour = 3600 seconds -PT1000000S = 1000000 seconds P1M1WT1H = 1 month + 1 week + 1 hour = 3236400 seconds It pretty strictly checks the spec, with a few exceptions:
- A week field ('W') may coexist with other units.
- Decimal values are not supported.
- The alternate format as a date and time is not supported.
Friends And Related Function Documentation
ostream& operator<< | ( | ostream & | os, |
const TimePeriod & | t | ||
) | [friend] |
Member Data Documentation
const TimePeriod frepple::utils::TimePeriod::MAX [static] |
const TimePeriod frepple::utils::TimePeriod::MIN [static] |
The documentation for this class was generated from the following files:
Documentation generated for frePPLe by
