os::DateTime Class Reference
[Various utillity classes.]

Abstract datatype for date and time. More...

Inheritance diagram for os::DateTime:

os::Flattenable List of all members.

Public Member Functions

 DateTime ()
 Default constructor.
 DateTime (const DateTime &cDateTime)
 Copy constructor.
 DateTime (const String &cTime)
 Constructor: string.
 DateTime (struct tm *psTime)
 Constructor: struct tm.
 DateTime (int nTime)
 Constructor: Unix Epoch.
 DateTime (int nYear, int nMonth, int nDay)
 Constructor: Date.
 DateTime (int nHour, int nMin, int nSec, int nUSec)
 Constructor: Time.
 ~DateTime ()
int GetDay () const
 Get day of month.
int GetMonth () const
 Get month of year.
int GetYear () const
 Get year.
int GetHour () const
 Get hours.
int GetMin () const
 Get minutes.
int GetSec () const
 Get seconds.
int GetUSec () const
int GetDayOfWeek () const
double GetDaycount () const
 Get number of days.
double GetJulianDate () const
 Get Julian date.
time_t GetEpoch () const
 Get Unix Epoch.
String GetDate () const
void SetTime (int nHour, int nMin, int nSec, int nUSec)
 Set time value.
void SetDate (int nYear, int nMonth, int nDay)
 Set date value.
bool SetDate (const String &cDate)
bool IsValid () const
 Check if date is valid.
DateTimeoperator= (const DateTime &cTime)
 Assign a DateTime value.
DateTime operator+ (const DateTime &cTime) const
 Add a DateTime value.
DateTime operator+ (double vDays) const
 Add a number of days to date.
DateTime operator- (const DateTime &cTime) const
 Subtract a DateTime value.
DateTime operator- (double vDays) const
 Subtract a number of days from date.
DateTimeoperator+= (const DateTime &cTime)
 Add a DateTime value.
DateTimeoperator+= (double vDays)
 Add a number of days to date.
DateTimeoperator-= (const DateTime &cTime)
 Subtract a DateTime value.
DateTimeoperator-= (double vDays)
 Subtract a number of days from date.
int operator== (const DateTime &cTime) const
 Compare dates.
int operator!= (const DateTime &cTime) const
 Compare dates.
int operator< (const DateTime &cTime) const
 Compare dates.
int operator> (const DateTime &cTime) const
 Compare dates.
 operator time_t () const
 operator std::string () const
 operator os::String () const
virtual size_t GetFlattenedSize (void) const
virtual status_t Flatten (uint8 *pBuffer, size_t nSize) const
virtual status_t Unflatten (const uint8 *pBuffer)
virtual int GetType (void) const

Static Public Member Functions

static DateTime Now ()
 Get current date and time.

Classes

class  Private

Detailed Description

Description:
DateTime is a storage class for date and time values. It also facilitates a number of arithmetic operations.
Examples:
        DateTime cToday = DateTime::Now();
        DateTime cTomorrow = cToday + 24.0;
        DateTime cLastYear = cToday - DateTime( 1, 0, 0 );
        double vNumberOfDays = ( cToday - DateTime( 2003, 8, 30 ) ).GetDaycount();
Author:
Henrik Isaksson ([email protected])


Constructor & Destructor Documentation

DateTime::DateTime (  ) 

Description:
Author:
Henrik Isaksson ([email protected])

DateTime::DateTime ( const DateTime cDateTime  ) 

Description:
Author:
Henrik Isaksson ([email protected])

DateTime::DateTime ( const String cDate  ) 

Description:
Creates a DateTime object from a string.
Author:
Henrik Isaksson ([email protected])

DateTime::DateTime ( struct tm *  psTime  ) 

Description:
Creates a DateTime object from a tm struct.
Author:
Henrik Isaksson ([email protected])

DateTime::DateTime ( int  nTime  ) 

Description:
Creates a DateTime object from a Unix Epoch number (ie. the number of seconds since 1970-01-01 00:00:00).
Author:
Henrik Isaksson ([email protected])

DateTime::DateTime ( int  nYear,
int  nMonth,
int  nDay 
)

Description:
Creates a DateTime object from year, month and day.
Author:
Henrik Isaksson ([email protected])

DateTime::DateTime ( int  nHour,
int  nMin,
int  nSec,
int  nUSec 
)

Description:
Creates a DateTime object from hour, minute, second and microsecond.
Author:
Henrik Isaksson ([email protected])

DateTime::~DateTime (  ) 


Member Function Documentation

int DateTime::GetDay (  )  const

Description:
Returns the day of month (1 - 31), or the number of days, if this DateTime object is used to represent a duration.
Author:
Henrik Isaksson ([email protected])

int DateTime::GetMonth (  )  const

Description:
Returns the month of year (1 - 12), or the number of months, if this DateTime object is used to represent a duration.
Author:
Henrik Isaksson ([email protected])

int DateTime::GetYear (  )  const

Description:
Returns the year, or the number of years, if this DateTime object is used to represent a duration.
Author:
Henrik Isaksson ([email protected])

int DateTime::GetHour (  )  const

Description:
Returns hours since midnight, or the number of hours if this DateTime object is used to represent a duration.
Author:
Henrik Isaksson ([email protected])

int DateTime::GetMin (  )  const

Description:
Returns minutes since the hour (0-59).
Author:
Henrik Isaksson ([email protected])

int DateTime::GetSec (  )  const

Description:
Returns seconds (0-59).
Author:
Henrik Isaksson ([email protected])

int os::DateTime::GetUSec (  )  const

int DateTime::GetDayOfWeek (  )  const

double DateTime::GetDaycount (  )  const

Description:
Returns the number of days since year 0. Use this method to get the difference between two dates as a number of days.
Author:
Henrik Isaksson ([email protected])

double DateTime::GetJulianDate (  )  const

Description:
Returns the number of days since 4712 B.C.
Author:
Henrik Isaksson ([email protected])

time_t DateTime::GetEpoch (  )  const

Description:
Returns the number of seconds since 1970-01-01 00:00:00.
Author:
Henrik Isaksson ([email protected])

String DateTime::GetDate (  )  const

void DateTime::SetTime ( int  nHour,
int  nMin,
int  nSec,
int  nUSec 
)

Description:
Set the time value of a DateTime object. The date value is left unchanged. No validity checking is performed.
Parameters:
nHour Hours since midnight
nMin Minutes past the hour
nSec Seconds
nUSec Microseconds
See also:
SetDate()
Author:
Henrik Isaksson ([email protected])

void DateTime::SetDate ( int  nYear,
int  nMonth,
int  nDay 
)

Description:
Set the date value of a DateTime object. The time value is left unchanged. No validity checking is performed, this method will happily accept a date like 2003-13-32. (This would be interpreted as 1 Feb 2004.)
Parameters:
nYear Year
nMonth Month
nDay Year
See also:
SetTime()
Author:
Henrik Isaksson ([email protected])

bool DateTime::SetDate ( const String cDate  ) 

bool DateTime::IsValid (  )  const

Description:
Returns true if the object contains a valid date. Examples of invalid dates include "2003-13-01", "2003-00-01", "2003-02-30" etc.
Author:
Henrik Isaksson ([email protected])

DateTime DateTime::Now (  )  [static]

Description:
Returns a DateTime object containing the current date and time.
Author:
Henrik Isaksson ([email protected])

DateTime & DateTime::operator= ( const DateTime cTime  ) 

Description:
Makes an exact copy of the source object.
Author:
Henrik Isaksson ([email protected])

DateTime DateTime::operator+ ( const DateTime cTime  )  const

Description:
Add one DateTime value to another. The result will be a valid Gregorian calendar date (months and years will be adjusted automatically), even if the operands are not valied dates.
Author:
Henrik Isaksson ([email protected])

DateTime DateTime::operator+ ( double  vDays  )  const

Description:
Add a number of days, or a fraction of a day, to the DateTime value. The result is a valid Gregorian calendar date (months and years will be adjusted automatically).
Author:
Henrik Isaksson ([email protected])

DateTime DateTime::operator- ( const DateTime cTime  )  const

Description:
Subtract one DateTime value from another. The result will be a valid Gregorian calendar date (months and value. The result is a valid Gregorian calendar date (months and years will be adjusted automatically), even if the operands are not valied dates.
Author:
Henrik Isaksson ([email protected])

DateTime DateTime::operator- ( double  vDays  )  const

Description:
Subtract a number of days, or a fraction of a day, from the DateTime value. The result is a valid Gregorian calendar date (months and years will be adjusted automatically).
Author:
Henrik Isaksson ([email protected])

DateTime & DateTime::operator+= ( const DateTime cTime  ) 

Description:
Add one DateTime value to another. The result will be a valid Gregorian calendar date (months and years will be adjusted automatically), even if the operands are not valied dates.
Author:
Henrik Isaksson ([email protected])

DateTime & DateTime::operator+= ( double  vDays  ) 

Description:
Add a number of days, or a fraction of a day, to the DateTime value. The result is a valid Gregorian calendar date (months and years will be adjusted automatically).
Author:
Henrik Isaksson ([email protected])

DateTime & DateTime::operator-= ( const DateTime cTime  ) 

Description:
Subtract one DateTime value from another. The result will be a valid Gregorian calendar date (months and value. The result is a valid Gregorian calendar date (months and years will be adjusted automatically), even if the operands are not valied dates.
Author:
Henrik Isaksson ([email protected])

DateTime & DateTime::operator-= ( double  vDays  ) 

Description:
Subtract a number of days, or a fraction of a day, from the DateTime value. The result is a valid Gregorian calendar date (months and years will be adjusted automatically).
Author:
Henrik Isaksson ([email protected])

int DateTime::operator== ( const DateTime cTime  )  const

Description:
Dates are compared according to their Julian date equivalents. This means that 2003-08-30 13:39 is considered equal to 2003-08-29 37:39.
Author:
Henrik Isaksson ([email protected])

int DateTime::operator!= ( const DateTime cTime  )  const

Description:
Dates are compared according to their Julian date equivalents. This means that 2003-08-30 13:39 is considered equal to 2003-08-29 37:39.
Author:
Henrik Isaksson ([email protected])

int DateTime::operator< ( const DateTime cTime  )  const

Description:
Dates are compared according to their Julian date equivalents. This means that 2003-08-30 13:39 is considered equal to 2003-08-29 37:39.
Author:
Henrik Isaksson ([email protected])

int DateTime::operator> ( const DateTime cTime  )  const

Description:
Dates are compared according to their Julian date equivalents. This means that 2003-08-30 13:39 is considered equal to 2003-08-29 37:39.
Author:
Henrik Isaksson ([email protected])

os::DateTime::operator time_t (  )  const [inline]

os::DateTime::operator std::string (  )  const [inline]

os::DateTime::operator os::String (  )  const [inline]

size_t DateTime::GetFlattenedSize ( void   )  const [virtual]

Implements os::Flattenable.

status_t DateTime::Flatten ( uint8 *  pBuffer,
size_t  nSize 
) const [virtual]

Implements os::Flattenable.

status_t DateTime::Unflatten ( const uint8 *  pBuffer  )  [virtual]

Implements os::Flattenable.

int DateTime::GetType ( void   )  const [virtual]

Implements os::Flattenable.


Generated on Sat May 9 22:51:07 2009 for Syllable higlevel API by  doxygen 1.5.1