LLDate Class Reference

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

#include <lldate.h>

List of all members.

Public Member Functions

 LLDate ()
 Construct a date equal to epoch.
 LLDate (const LLDate &date)
 Construct a date equal to epoch.
 LLDate (F64 seconds_since_epoch)
 Construct a date from a seconds since epoch value.
 LLDate (const std::string &iso8601_date)
 Construct a date from a string representation.
std::string asString () const
 Return the date as in ISO-8601 string.
std::string asRFC1123 () const
void toStream (std::ostream &) const
void toHTTPDateStream (std::ostream &) const
bool fromString (const std::string &iso8601_date)
 Set the date from an ISO-8601 string.
bool fromStream (std::istream &)
F64 secondsSinceEpoch () const
 Return the date in seconds since epoch.
void secondsSinceEpoch (F64 seconds)
 Set the date in seconds since epoch.

Private Attributes

F64 mSecondsSinceEpoch


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.

Definition at line 47 of file lldate.h.


Constructor & Destructor Documentation

LLDate::LLDate (  ) 

Construct a date equal to epoch.

Definition at line 49 of file lldate.cpp.

LLDate::LLDate ( const LLDate date  ) 

Construct a date equal to epoch.

Definition at line 53 of file lldate.cpp.

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.

Definition at line 58 of file lldate.cpp.

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.

Definition at line 63 of file lldate.cpp.

References DATE_EPOCH, fromString(), llendl, llwarns, and mSecondsSinceEpoch.


Member Function Documentation

std::string LLDate::asRFC1123 (  )  const

Definition at line 85 of file lldate.cpp.

References toHTTPDateStream().

std::string LLDate::asString (  )  const

Return the date as in ISO-8601 string.

Returns:
A string representation of the date.

Definition at line 73 of file lldate.cpp.

References toStream().

bool LLDate::fromStream ( std::istream &   ) 

Definition at line 165 of file lldate.cpp.

References c, LL_APR_USEC_PER_SEC, and mSecondsSinceEpoch.

Referenced by fromString(), and operator>>().

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.

Definition at line 159 of file lldate.cpp.

References fromStream().

Referenced by LLDate().

void LLDate::secondsSinceEpoch ( F64  seconds  ) 

Set the date in seconds since epoch.

Parameters:
seconds The number of seconds since epoch UTC.

Definition at line 232 of file lldate.cpp.

References mSecondsSinceEpoch.

F64 LLDate::secondsSinceEpoch (  )  const

Return the date in seconds since epoch.

Returns:
The number of seconds since epoch UTC.

Definition at line 227 of file lldate.cpp.

References mSecondsSinceEpoch.

Referenced by tut::ensure_equals().

void LLDate::toHTTPDateStream ( std::ostream &   )  const

Definition at line 92 of file lldate.cpp.

References LL_APR_USEC_PER_SEC, llendl, llinfos, months, mSecondsSinceEpoch, right, and weekdays.

Referenced by asRFC1123().

void LLDate::toStream ( std::ostream &   )  const

Definition at line 128 of file lldate.cpp.

References LL_APR_USEC_PER_SEC, mSecondsSinceEpoch, and right.

Referenced by asString(), and operator<<().


Member Data Documentation

F64 LLDate::mSecondsSinceEpoch [private]

Definition at line 116 of file lldate.h.

Referenced by fromStream(), LLDate(), secondsSinceEpoch(), toHTTPDateStream(), and toStream().


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:11:14 2010 for Second Life Viewer by  doxygen 1.4.7