This class represents a particular point in time in UTC. More...
#include <lldate.h>
Public Member Functions | |
std::string | asString () const |
Return the date as in ISO-8601 string. | |
bool | fromString (const std::string &iso8601_date) |
Set the date from an ISO-8601 string. | |
LLDate (const std::string &iso8601_date) | |
Construct a date from a string representation. | |
LLDate (F64 seconds_since_epoch) | |
Construct a date from a seconds since epoch value. | |
LLDate (const LLDate &date) | |
Construct a date equal the source date. | |
LLDate () | |
Construct a date equal to epoch. | |
bool | operator< (const LLDate &rhs) const |
Compare dates using operator< so we can order them using STL. | |
bool | operator> (const LLDate &rhs) const |
Remaining comparison operators in terms of operator< This conforms to the expectation of STL. | |
void | secondsSinceEpoch (F64 seconds) |
Set the date in seconds since epoch. | |
F64 | secondsSinceEpoch () const |
Return the date in seconds since epoch. | |
Static Public Member Functions | |
static LLDate | now () |
Create an LLDate object set to the current time. |
This class represents a particular point in time in UTC.
The date class represents a point in time after epoch - 1970-01-01.
LLDate::LLDate | ( | F64 | seconds_since_epoch | ) |
Construct a date from a seconds since epoch value.
seconds_since_epoch The number of seconds since UTC epoch.
LLDate::LLDate | ( | const std::string & | iso8601_date | ) |
Construct a date from a string representation.
The date is constructed in the fromString()
method. See that method for details of supported formats. If that method fails to parse the date, the date is set to epoch.
iso8601_date | An iso-8601 compatible representation of the date. |
std::string LLDate::asString | ( | ) | const |
Return the date as in ISO-8601 string.
bool LLDate::fromString | ( | const std::string & | iso8601_date | ) |
Set the date from an ISO-8601 string.
The parser only supports strings conforming to YYYYF-MM-DDTHH:MM:SS.FFZ where Y is year, M is month, D is day, H is hour, M is minute, S is second, F is sub-second, and all other characters are literal. If this method fails to parse the date, the previous date is retained.
iso8601_date | An iso-8601 compatible representation of the date. |
LLDate LLDate::now | ( | ) | [static] |
Create an LLDate object set to the current time.
bool LLDate::operator< | ( | const LLDate & | rhs | ) | const |
Compare dates using operator< so we can order them using STL.
rhs | -- the right hand side of the comparison operator |
bool LLDate::operator> | ( | const LLDate & | rhs | ) | const [inline] |
Remaining comparison operators in terms of operator< This conforms to the expectation of STL.
rhs | -- the right hand side of the comparison operator |
void LLDate::secondsSinceEpoch | ( | F64 | seconds | ) |
Set the date in seconds since epoch.
seconds | The number of seconds since epoch UTC. |
F64 LLDate::secondsSinceEpoch | ( | ) | const |
Return the date in seconds since epoch.