Made to Order Software Corporation Logo

LLChatLib: LLDate Class Reference

LLDate Class Reference

This class represents a particular point in time in UTC. More...

#include <lldate.h>

List of all members.

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.


Detailed Description

This class represents a particular point in time in UTC.

The date class represents a point in time after epoch - 1970-01-01.


Constructor & Destructor Documentation

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.

Parameters:
iso8601_date An iso-8601 compatible representation of the date.

Here is the call graph for this function:


Member Function Documentation

std::string LLDate::asString (  )  const

Return the date as in ISO-8601 string.

Returns:
A string representation of the date.
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.

Parameters:
iso8601_date An iso-8601 compatible representation of the date.
Returns:
Returns true if the string was successfully parsed.
LLDate LLDate::now (  )  [static]

Create an LLDate object set to the current time.

Returns:
The number of seconds since epoch UTC.

Here is the call graph for this function:

bool LLDate::operator< ( const LLDate rhs  )  const

Compare dates using operator< so we can order them using STL.

Parameters:
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.

Parameters:
rhs -- the right hand side of the comparison operator
void LLDate::secondsSinceEpoch ( F64  seconds  ) 

Set the date in seconds since epoch.

Parameters:
seconds The number of seconds since epoch UTC.
F64 LLDate::secondsSinceEpoch (  )  const

Return the date in seconds since epoch.

Returns:
The number of seconds since epoch UTC.

The documentation for this class was generated from the following files:
  • /home/doug/src/oss/slitechat/trunk/LLChatLib/llcommon/lldate.h
  • /home/doug/src/oss/slitechat/trunk/LLChatLib/llcommon/lldate.cpp
Generated on Thu Sep 23 17:18:40 2010 for LLChatLib by  doxygen 1.6.3