ionflux.org | Impressum

Ionflux::Tools::DateTime Class Reference
[Date and time]

Date and Time. More...

#include <DateTime.hpp>

Collaboration diagram for Ionflux::Tools::DateTime:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DateTime ()
 Constructor.
 DateTime (time_t initTime)
 Constructor.
 DateTime (TimeTicks initTime)
 Constructor.
 DateTime (struct tm initTime)
 Constructor.
 DateTime (const std::string &initTime)
 Constructor.
 DateTime (const DateTime &initTime)
 Constructor.
 DateTime (int initYear, int initMonth, int initDay, int initHour, int initMinute, int initSecond)
 Constructor.
virtual ~DateTime ()
 Destructor.
virtual void setTime (time_t newTime)
 Set time.
virtual void setTime (TimeTicks newTime)
 Set time.
virtual void setTime (tm newTime)
 Set time.
virtual void setTime (const std::string &newTime)
 Set time.
virtual void setTime (const DateTime &newTime)
 Set time.
virtual void setTime (int newYear, int newMonth, int newDay, int newHour, int newMinute, int newSecond)
 Set time.
virtual void setLocalTime (const DateTime &newTime, bool newDSTState)
 Set local time.
virtual void setLocalTime (const std::string &newTime, bool newDSTState)
 Set local time.
virtual void setLocalTime (int newYear, int newMonth, int newDay, int newHour, int newMinute, int newSecond, bool newDSTState)
 Set local time.
virtual void setLocalTime (const DateTime &newTime)
 Set local time.
virtual void setLocalTime (const std::string &newTime)
 Set local time.
virtual void setLocalTime (int newYear, int newMonth, int newDay, int newHour, int newMinute, int newSecond)
 Set local time.
virtual void setHMS (int newHour, int newMinute, int newSecond)
 Set time of day.
virtual void setHMS (const std::string &newTime)
 Set time of day.
virtual void setHMS (const DateTime &sourceTime)
 Set time of day.
virtual void setLocalHMS (int newHour, int newMinute, int newSecond, bool newDSTState)
 Set time of day.
virtual void setLocalHMS (const std::string &newTime, bool newDSTState)
 Set time of day.
virtual void setLocalHMS (const DateTime &sourceTime, bool newDSTState)
 Set time of day.
virtual void setLocalHMS (int newHour, int newMinute, int newSecond)
 Set time of day.
virtual void setLocalHMS (const std::string &newTime)
 Set time of day.
virtual void setLocalHMS (const DateTime &sourceTime)
 Set time of day.
virtual DateTimeshift (int shiftSeconds)
 Shift DateTime.
virtual TimeTicks diff (const DateTime &diffTime) const
 Calculate DateTime difference.
virtual void setTimeZone (const TimeZone *newTimeZone, bool newManage)
 Set time zone.
virtual void setTimeZone (const std::string &newTimeZone)
 Set time zone.
virtual int compareHMS (int otherHour, int otherMinute, int otherSecond)
 Compare time of day.
virtual int compareHMS (const DateTime &otherTime)
 Compare time of day.
virtual int compareHMS (const std::string &otherTime)
 Compare time of day.
virtual int compareDay (const DateTime &otherTime)
 Compare day.
virtual DateTime getUTC ()
 Get UTC representation.
virtual TimeTicks getTicks () const
 Get UTC seconds.
virtual time_t getTime () const
 Get POSIX timestamp.
virtual tm getBrokenTime () const
 Get broken down calendar time.
virtual std::string getTimestamp ()
 Get timestamp.
virtual std::string getHMS ()
 Get time of day.
virtual Year getYear () const
 Get year.
virtual int getMonth () const
 Get month.
virtual int getDay () const
 Get day.
virtual int getHour () const
 Get hour.
virtual int getMinute () const
 Get minute.
virtual int getSecond () const
 Get second.
virtual int getDayOfWeek () const
 Get day of week.
virtual int getDayOfYear () const
 Get day of year.
virtual std::string getDayOfWeekName () const
 Get day of week name.
virtual std::string getDayOfWeekShortName () const
 Get short day of week name.
virtual std::string getMonthName () const
 Get month name.
virtual std::string getMonthShortName () const
 Get month short name.
virtual const TimeZonegetTimeZone () const
 Get time zone.
virtual std::string getTimeZoneName () const
 Get name of time zone.
virtual std::string getTimeZoneAliases () const
 Get time zone aliases.
virtual bool isDST () const
 Get DST state.
virtual int getUTCOffset () const
 Get UTC offset.
virtual std::string getRFCTimestamp () const
 Get RFC 822 timestamp.
virtual DateTimeoperator= (const DateTime &newTime)
 Assignment operator.
virtual DateTimeoperator+= (TimeTicks seconds)
 Add operator.
virtual DateTimeoperator-= (TimeTicks seconds)
 Substract operator.
virtual TimeTicks operator- (const DateTime &diffTime) const
 Substract operator.
virtual bool operator== (const DateTime &compTime) const
 Comparison operator.
virtual bool operator> (const DateTime &compTime) const
 Comparison operator.
virtual bool operator< (const DateTime &compTime) const
 Comparison operator.
virtual bool operator>= (const DateTime &compTime) const
 Comparison operator.
virtual bool operator<= (const DateTime &compTime) const
 Comparison operator.

Static Public Member Functions

static void makeBrokenTime (time_t *source, tm *target)
 Create broken down calendar time.
static Year countLeapYears (Year limit)
 Count leap years.
static bool isLeapYear (Year checkYear)
 Check leap year status.
static DateTime getNth (Year targetYear, int targetMonth, int targetWeekDay, int n)
 Get n-th occurence of a day of week in a month.
static bool isTime (const std::string &checkTime)
 Check time.
static bool isDate (const std::string &checkDate)
 Check date.
static bool isDatetime (const std::string &checkDatetime)
 Check datetime.

Static Public Attributes

static const std::string TIMESTAMP_DATE_SEP = "-"
 Timestamp date separator.
static const std::string TIMESTAMP_TIME_SEP = ":"
 Timestamp time separator.
static const std::string TIMESTAMP_DATETIME_SEP = " "
 Timestamp datetime separator.
static const int NUM_DAYS []
 Number of days up to the beginning of the first day of month j + 1 for non-leap years (NUM_DAYS[0.
static const int LEAP_MONTH = 2
 Leap month.
static const TimeTicks POSIX_EPOCH = 62135596800LL
 Start tick count for POSIX epoch.
static const TimeTicks TICKS_400Y = 12622780800LL
 Leap year neutral tick step: 400 years.
static const TimeTicks TICKS_100Y = 3155673600LL
 Leap year neutral tick step: 100 years.
static const TimeTicks TICKS_4Y = 126230400LL
 Leap year neutral tick step: 4 years.
static const TimeTicks TICKS_3Y = 94608000LL
 Leap year neutral tick step: 3 years.
static const TimeTicks TICKS_1Y = 31536000LL
 Leap year neutral tick step: 1 year.
static const TimeTicks TICKS_1D = 86400LL
 Ticks per day.
static const TimeTicks REF_SUNDAY = 63223891200LL
 Reference ticks of a sunday.
static const char * WEEKDAY_NAME []
 Weekday names.
static const char * WEEKDAY_NAME_SHORT []
 Weekday names (short).
static const char * MONTH_NAME []
 Month names.
static const char * MONTH_NAME_SHORT []
 Month names (short).
static const TimeZone TZ_UTC
 Time zone: UTC.
static const TimeZone TZ_UTC_P0100
 Time zone: UTC+0100.
static const TimeZone TZ_UTC_P0200
 Time zone: UTC+0200.
static const TimeZone TZ_UTC_P0300
 Time zone: UTC+0300.
static const TimeZone TZ_UTC_P0330
 Time zone: UTC+0330.
static const TimeZone TZ_UTC_P0400
 Time zone: UTC+0400.
static const TimeZone TZ_UTC_P0430
 Time zone: UTC+0430.
static const TimeZone TZ_UTC_P0500
 Time zone: UTC+0500.
static const TimeZone TZ_UTC_P0530
 Time zone: UTC+0530.
static const TimeZone TZ_UTC_P0545
 Time zone: UTC+0545.
static const TimeZone TZ_UTC_P0600
 Time zone: UTC+0600.
static const TimeZone TZ_UTC_P0630
 Time zone: UTC+0630.
static const TimeZone TZ_UTC_P0700
 Time zone: UTC+0700.
static const TimeZone TZ_UTC_P0800
 Time zone: UTC+0800.
static const TimeZone TZ_UTC_P0900
 Time zone: UTC+0900.
static const TimeZone TZ_UTC_P0930
 Time zone: UTC+0930.
static const TimeZone TZ_UTC_P1000
 Time zone: UTC+1000.
static const TimeZone TZ_UTC_P1100
 Time zone: UTC+1100.
static const TimeZone TZ_UTC_P1200
 Time zone: UTC+1100.
static const TimeZone TZ_UTC_M0100
 Time zone: UTC-0100.
static const TimeZone TZ_UTC_M0200
 Time zone: UTC-0200.
static const TimeZone TZ_UTC_M0300
 Time zone: UTC-0300.
static const TimeZone TZ_UTC_M0400
 Time zone: UTC-0400.
static const TimeZone TZ_UTC_M0500
 Time zone: UTC-0500.
static const TimeZone TZ_UTC_M0600
 Time zone: UTC-0600.
static const TimeZone TZ_UTC_M0700
 Time zone: UTC-0700.
static const TimeZone TZ_UTC_M0800
 Time zone: UTC-0800.
static const TimeZone TZ_UTC_M0900
 Time zone: UTC-0900.
static const TimeZone TZ_UTC_M1000
 Time zone: UTC-1000.
static const TimeZone TZ_UTC_M1100
 Time zone: UTC-1100.
static const TimeZone TZ_UTC_M1200
 Time zone: UTC-1100.
static const TimeZone TZ_GMT
 Time zone: GMT.
static const TimeZone TZ_EUROPE_WESTERN
 Time zone: Europe/Western (WET/WEST).
static const TimeZone TZ_EUROPE_CENTRAL
 Time zone: Europe/Central (CET/CEST).
static const TimeZone TZ_EUROPE_EASTERN
 Time zone: Europe/Eastern (EET/EEST).
static const TimeZone TZ_UK
 Time zone: United Kingdom (WET/BST).
static const TimeZone TZ_USA_EASTERN
 Time zone: USA/Eastern (EST/EDT).
static const TimeZone TZ_USA_CENTRAL
 Time zone: USA/Central (CST/CDT).
static const TimeZone TZ_USA_MOUNTAIN
 Time zone: USA/Mountain (MST/MDT).
static const TimeZone TZ_USA_PACIFIC
 Time zone: USA/Pacific (PST/PDT).
static const TimeZone TZ_USA_ALASKA
 Time zone: USA/Alaska (AKST/AKDT).
static const TimeZone TZ_RUSSIA_WESTERN
 Time zone: Russia/Western (UTC+03).
static const TimeZone TZ_EGYPT
 Time zone: Egypt (UTC+02).

Protected Member Functions

virtual void parseTimestamp (const std::string &source)
 Parse a timestamp.
virtual std::string createTimestamp ()
 Create a timestamp.
virtual void updateTicks ()
 Update ticks from broken down calendar time.
virtual void updateBrokenDownTime (int tickOffset)
 Update broken down calendar time from ticks.
virtual void initTimeZones ()
 Initialize default time zones.

Protected Attributes

TimeTicks ticks
 Number of UTC seconds since 0001-01-01 00:00:00.
std::string timestamp
 Timestamp (string representation, "YYYY-MM-DD HH:MM:SS").
const TimeZonetimeZone
 Local time zone.
Year year
 Broken down time: Year.
int month
 Broken down time: Month (1...12).
int day
 Broken down time: Day of month (1...31).
int hour
 Broken down time: Hour (0...23).
int minute
 Broken down time: Minute (0...59).
int second
 Broken down time: Second (0...59).
int weekDay
 Broken down time: Day of week (0...6, where 0 = Sunday).
int yearDay
 Broken down time: Day of year (1...366).
bool dstState
 Broken down time: DST flag.
int utcOffset
 Broken down time: UTC offset (minutes).
bool manageTimeZone
 Time zone memory management flag.
std::vector< const TimeZone * > defaultTimeZones
 Vector of default time zones.

Detailed Description

Date and Time.

Date and time wrapper with various manipulation and conversion facilities.


Constructor & Destructor Documentation

Ionflux::Tools::DateTime::DateTime  ) 
 

Constructor.

Construct new DateTime object which will be initialized with the current local time.

Ionflux::Tools::DateTime::DateTime time_t  initTime  ) 
 

Constructor.

Construct new DateTime object which will be initialized with the POSIX timestamp passed as an argument.

Parameters:
initTime POSIX timestamp.

Ionflux::Tools::DateTime::DateTime TimeTicks  initTime  ) 
 

Constructor.

Construct new DateTime object which will be initialized with the UTC seconds passed as an argument.

Parameters:
initTime Number of UTC seconds since 0001-01-01 00:00:00.

Ionflux::Tools::DateTime::DateTime struct tm  initTime  ) 
 

Constructor.

Construct new DateTime object which will be initialized with the broken down calendar time passed as an argument.

Parameters:
initTime Broken down calendar time.

Ionflux::Tools::DateTime::DateTime const std::string &  initTime  ) 
 

Constructor.

Construct new DateTime object which will be initialized with the timestamp (string representation, "YYYY-MM-DD HH:MM:SS") passed as an argument.

Parameters:
initTime Timestamp.

Ionflux::Tools::DateTime::DateTime const DateTime initTime  ) 
 

Constructor.

Construct new DateTime object which will be initialized with another DateTime object.

Parameters:
initTime DateTime object.

Ionflux::Tools::DateTime::DateTime int  initYear,
int  initMonth,
int  initDay,
int  initHour,
int  initMinute,
int  initSecond
 

Constructor.

Construct new DateTime object which will be initialized with the specified date and time.

Parameters:
initYear Year.
initMonth Month (1...12).
initDay Day of month (1...31).
initHour Hour (0...23).
initMinute (0...59).
initSecond (0...59).

Ionflux::Tools::DateTime::~DateTime  )  [virtual]
 

Destructor.

Destruct DateTime object.


Member Function Documentation

int Ionflux::Tools::DateTime::compareDay const DateTime otherTime  )  [virtual]
 

Compare day.

Compares day to that of another Datetime.

Parameters:
otherTime DateTime to compare this object with.
Returns:
0 if the days are equal, -1 if the day of this object is less than, +1 if it is greater than the day of the argument.

int Ionflux::Tools::DateTime::compareHMS const std::string &  otherTime  )  [virtual]
 

Compare time of day.

Compares time of day (HH:MM:SS) only, without respect to time zone or DST offsets.

Parameters:
otherTime Time of day to compare this object with (string representation, "HH[:MM[:SS]]").
Returns:
0 if the times of day are equal, -1 if the time of day of this object is less than, +1 if it is greater than the time of day of the argument.

int Ionflux::Tools::DateTime::compareHMS const DateTime otherTime  )  [virtual]
 

Compare time of day.

Compares time of day (HH:MM:SS) only, without respect to time zone or DST offsets.

Parameters:
otherTime DateTime to compare this object with.
Returns:
0 if the times of day are equal, -1 if the time of day of this object is less than, +1 if it is greater than the time of day of the argument.

int Ionflux::Tools::DateTime::compareHMS int  otherHour,
int  otherMinute,
int  otherSecond
[virtual]
 

Compare time of day.

Compares time of day (HH:MM:SS) only, without respect to time zone or DST offsets.

Parameters:
otherHour Hour (0...23).
otherMinute (0...59).
otherSecond (0...59).
Returns:
0 if the times of day are equal, -1 if the time of day of this object is less than, +1 if it is greater than the time of day of the argument.

Year Ionflux::Tools::DateTime::countLeapYears Year  limit  )  [static]
 

Count leap years.

Count the number of leap years from 0001-01-01 00:00:00 up to January 1st, 00:00:00 of the specified year.

Parameters:
limit Limit for counting leap years.
Returns:
Number of leap years up to specified year.

std::string Ionflux::Tools::DateTime::createTimestamp  )  [protected, virtual]
 

Create a timestamp.

Create a timestamp in string representation ("YYYY-MM-DD HH:MM:SS").

See also:
getTimestamp()
Returns:
Timestamp.

TimeTicks Ionflux::Tools::DateTime::diff const DateTime diffTime  )  const [virtual]
 

Calculate DateTime difference.

Calculate the difference (in seconds) of two DateTime objects.

Parameters:
diffTime DateTime to substract.
Returns:
Difference of the datetimes, in seconds.

tm Ionflux::Tools::DateTime::getBrokenTime  )  const [virtual]
 

Get broken down calendar time.

Note:
This is not thread-safe on systems that do not provide localtime_r (i.e. win32).
Deprecated:
You should not use this, since this function may not be thread-safe on all systems. Besides, struct tm is obsolete and inconsistent. Use getYear(), getMonth(), getDay() etc. instead. This function is provided for backward compatibility only.
Returns:
Broken down time.

int Ionflux::Tools::DateTime::getDay  )  const [virtual]
 

Get day.

Returns:
Day of month (1...31).

int Ionflux::Tools::DateTime::getDayOfWeek  )  const [virtual]
 

Get day of week.

Returns:
Day of week (0...6, where 0 = Sunday).

std::string Ionflux::Tools::DateTime::getDayOfWeekName  )  const [virtual]
 

Get day of week name.

Returns:
Name of day of week.

std::string Ionflux::Tools::DateTime::getDayOfWeekShortName  )  const [virtual]
 

Get short day of week name.

Returns:
Short name of day of week.

int Ionflux::Tools::DateTime::getDayOfYear  )  const [virtual]
 

Get day of year.

Returns:
Day of year (1...366).

std::string Ionflux::Tools::DateTime::getHMS  )  [virtual]
 

Get time of day.

Get time of day in string representation ("HH:MM:SS").

Returns:
Time of day.

int Ionflux::Tools::DateTime::getHour  )  const [virtual]
 

Get hour.

Returns:
Hour (0...23).

int Ionflux::Tools::DateTime::getMinute  )  const [virtual]
 

Get minute.

Returns:
Minute (0...59).

int Ionflux::Tools::DateTime::getMonth  )  const [virtual]
 

Get month.

Returns:
Month (1...12).

std::string Ionflux::Tools::DateTime::getMonthName  )  const [virtual]
 

Get month name.

Returns:
Month name.

std::string Ionflux::Tools::DateTime::getMonthShortName  )  const [virtual]
 

Get month short name.

Returns:
Month short name.

DateTime Ionflux::Tools::DateTime::getNth Year  targetYear,
int  targetMonth,
int  targetWeekDay,
int  n
[static]
 

Get n-th occurence of a day of week in a month.

Returns the UTC DateTime of the start (00:00:00) of the n-th occurrence of the specified day of week in the specified month of the specified year. If this day is not present in the requested month, the last occurence of that day in the specified month is returned. You can use this to get the last occurence of any day of week within a month by setting n to 5;

Parameters:
targetYear Year.
targetMonth Month (1...12).
targetWeekDay Day of week (0...6, where 0 = Sunday).
n Occurrence count of day of week in specified month (1...5)
Returns:
Datetime of n-th occurence of specified day of week..

std::string Ionflux::Tools::DateTime::getRFCTimestamp  )  const [virtual]
 

Get RFC 822 timestamp.

Returns:
RFC 822 timestamp.

int Ionflux::Tools::DateTime::getSecond  )  const [virtual]
 

Get second.

Returns:
Second (0...59).

TimeTicks Ionflux::Tools::DateTime::getTicks  )  const [virtual]
 

Get UTC seconds.

Get datetime as number of UTC seconds since 0001-01-01 00:00:00 (not counting leap seconds).

Returns:
UTC seconds since 0001-01-01 00:00:00.

time_t Ionflux::Tools::DateTime::getTime  )  const [virtual]
 

Get POSIX timestamp.

Get datetime as POSIX timestamp, i.e. number of seconds since the beginning of the POSIX epoch.

Deprecated:
You should not use this, since the range of POSIX timestamps is limited to the years 1970 to 2038. Use getTicks() instead. This function is provided for backward compatibility only.
Returns:
POSIX timestamp.

std::string Ionflux::Tools::DateTime::getTimestamp  )  [virtual]
 

Get timestamp.

Get timestamp in string representation ("YYYY-MM-DD HH:MM:SS").

Returns:
Timestamp.

const TimeZone * Ionflux::Tools::DateTime::getTimeZone  )  const [virtual]
 

Get time zone.

Returns:
Time zone object used by this datetime, or 0 if no time zone has been specified.

std::string Ionflux::Tools::DateTime::getTimeZoneAliases  )  const [virtual]
 

Get time zone aliases.

Get a colon (':') separated list of all recognized time zone alias names. These are the names you can use to set the time zone with setTimeZone().

Returns:
Colon (':') separated list of time zone alias names.

std::string Ionflux::Tools::DateTime::getTimeZoneName  )  const [virtual]
 

Get name of time zone.

Returns:
Time zone (short) name, including DST distinctions if available.

DateTime Ionflux::Tools::DateTime::getUTC  )  [virtual]
 

Get UTC representation.

Get an UTC representation of a datetime.

Returns:
UTC datetime.

int Ionflux::Tools::DateTime::getUTCOffset  )  const [virtual]
 

Get UTC offset.

Returns:
UTC offset, in minutes.

Year Ionflux::Tools::DateTime::getYear  )  const [virtual]
 

Get year.

Returns:
Year.

void Ionflux::Tools::DateTime::initTimeZones  )  [protected, virtual]
 

Initialize default time zones.

bool Ionflux::Tools::DateTime::isDate const std::string &  checkDate  )  [static]
 

Check date.

Check whether the specified string represents a date (i.e. has the format "YYYY-MM-DD"). Range checks are performed for month and day, however, it is not checked whether the specified day is actually a valid date.

Parameters:
checkDate String to be checked.
Returns:
true if checkDate represents a date, false otherwise.

bool Ionflux::Tools::DateTime::isDatetime const std::string &  checkDatetime  )  [static]
 

Check datetime.

Check whether the specified string represents a datetime (i.e. has the format "YYYY-MM-DD[ HH[:MM[:SS]]]"). Range checks are performed for hours, minutes, seconds, month and day, however, it is not checked whether the specified datetime is actually a valid date.

Parameters:
checkDatetime String to be checked.
Returns:
true if checkDatetime represents a datetime, false otherwise.

bool Ionflux::Tools::DateTime::isDST  )  const [virtual]
 

Get DST state.

Returns:
true if this datetime represents DST in the current time zone, false otherwise.

bool Ionflux::Tools::DateTime::isLeapYear Year  checkYear  )  [static]
 

Check leap year status.

Returns true if the specified year is a leap year.

Parameters:
checkYear Year.
Returns:
true if specified year is a leap year, false otherwise.

bool Ionflux::Tools::DateTime::isTime const std::string &  checkTime  )  [static]
 

Check time.

Check whether the specified string represents a time of day (i.e. has the format"HH[:MM[:SS]]"). Range checks are performed for hours, minutes and seconds.

Parameters:
checkTime String to be checked.
Returns:
true if checkTime represents a time of day, false otherwise.

void Ionflux::Tools::DateTime::makeBrokenTime time_t *  source,
tm *  target
[static]
 

Create broken down calendar time.

Creates a broken down calendar time from a POSIX timestamp.

Note:
This is not thread-safe on systems that do not provide localtime_r (i.e. win32).
Deprecated:
You should not use this, since this function may not be thread-safe on all systems. Besides, struct tm is obsolete and inconsistent. Use getYear(), getMonth(), getDay() etc. instead. This function is provided for backward compatibility only.

DateTime & Ionflux::Tools::DateTime::operator+= TimeTicks  seconds  )  [virtual]
 

Add operator.

TimeTicks Ionflux::Tools::DateTime::operator- const DateTime diffTime  )  const [virtual]
 

Substract operator.

DateTime & Ionflux::Tools::DateTime::operator-= TimeTicks  seconds  )  [virtual]
 

Substract operator.

bool Ionflux::Tools::DateTime::operator< const DateTime compTime  )  const [virtual]
 

Comparison operator.

bool Ionflux::Tools::DateTime::operator<= const DateTime compTime  )  const [virtual]
 

Comparison operator.

DateTime & Ionflux::Tools::DateTime::operator= const DateTime newTime  )  [virtual]
 

Assignment operator.

bool Ionflux::Tools::DateTime::operator== const DateTime compTime  )  const [virtual]
 

Comparison operator.

bool Ionflux::Tools::DateTime::operator> const DateTime compTime  )  const [virtual]
 

Comparison operator.

bool Ionflux::Tools::DateTime::operator>= const DateTime compTime  )  const [virtual]
 

Comparison operator.

void Ionflux::Tools::DateTime::parseTimestamp const std::string &  source  )  [protected, virtual]
 

Parse a timestamp.

Parse a timestamp in string representation ("YYYY-MM-DD HH:MM:SS").

Parameters:
source Timestamp.

void Ionflux::Tools::DateTime::setHMS const DateTime sourceTime  )  [virtual]
 

Set time of day.

Sets the time of day (UTC).

Parameters:
sourceTime DateTime to set the time of day from.

void Ionflux::Tools::DateTime::setHMS const std::string &  newTime  )  [virtual]
 

Set time of day.

Sets the time of day (UTC).

Parameters:
newTime Time of day (string representation, "HH[:MM[:SS]]").

void Ionflux::Tools::DateTime::setHMS int  newHour,
int  newMinute,
int  newSecond
[virtual]
 

Set time of day.

Sets the time of day (UTC).

Parameters:
newHour Hour (0...23).
newMinute (0...59).
newSecond (0...59).

void Ionflux::Tools::DateTime::setLocalHMS const DateTime sourceTime  )  [virtual]
 

Set time of day.

Sets the time of day (local time).

Note:
This function will attempt to determine the DST state automatically. Note that DST state is ambiguous during one hour of the year (see TimeZone::localIsDST() for details on how this case is handled).
Parameters:
sourceTime DateTime to set the time of day from.
See also:
setTimeZone() setHMS() TimeZone::localIsDST()

void Ionflux::Tools::DateTime::setLocalHMS const std::string &  newTime  )  [virtual]
 

Set time of day.

Sets the time of day (local time).

Note:
This function will attempt to determine the DST state automatically. Note that DST state is ambiguous during one hour of the year (see TimeZone::localIsDST() for details on how this case is handled).
Parameters:
newTime Time of day (string representation, "HH[:MM[:SS]]").
See also:
setTimeZone() setHMS() TimeZone::localIsDST()

void Ionflux::Tools::DateTime::setLocalHMS int  newHour,
int  newMinute,
int  newSecond
[virtual]
 

Set time of day.

Sets the time of day (local time).

Note:
This function will attempt to determine the DST state automatically. Note that DST state is ambiguous during one hour of the year (see TimeZone::localIsDST() for details on how this case is handled).
Parameters:
newHour Hour (0...23).
newMinute (0...59).
newSecond (0...59).
See also:
setTimeZone() setHMS() TimeZone::localIsDST()

void Ionflux::Tools::DateTime::setLocalHMS const DateTime sourceTime,
bool  newDSTState
[virtual]
 

Set time of day.

Sets the time of day (local time).

Parameters:
sourceTime DateTime to set the time of day from.
newDSTState Whether this local time represents daylight saving time.
See also:
setTimeZone() setHMS()

void Ionflux::Tools::DateTime::setLocalHMS const std::string &  newTime,
bool  newDSTState
[virtual]
 

Set time of day.

Sets the time of day (local time).

Parameters:
newTime Time of day (string representation, "HH[:MM[:SS]]").
newDSTState Whether this local time represents daylight saving time.
See also:
setTimeZone() setHMS()

void Ionflux::Tools::DateTime::setLocalHMS int  newHour,
int  newMinute,
int  newSecond,
bool  newDSTState
[virtual]
 

Set time of day.

Sets the time of day (local time).

Parameters:
newHour Hour (0...23).
newMinute (0...59).
newSecond (0...59).
newDSTState Whether this local time represents daylight saving time.
See also:
setTimeZone() setHMS()

void Ionflux::Tools::DateTime::setLocalTime int  newYear,
int  newMonth,
int  newDay,
int  newHour,
int  newMinute,
int  newSecond
[virtual]
 

Set local time.

Set the local date and time represented by this DateTime object.

Note:
This function will attempt to determine the DST state automatically. Note that DST state is ambiguous during one hour of the year (see TimeZone::localIsDST() for details on how this case is handled).
Parameters:
newYear Year.
newMonth Month (1...12).
newDay Day of month (1...31).
newHour Hour (0...23).
newMinute (0...59).
newSecond (0...59).
See also:
setTimeZone() TimeZone::localIsDST()

void Ionflux::Tools::DateTime::setLocalTime const std::string &  newTime  )  [virtual]
 

Set local time.

Set the local date and time represented by this DateTime object.

Note:
This function will attempt to determine the DST state automatically. Note that DST state is ambiguous during one hour of the year (see TimeZone::localIsDST() for details on how this case is handled).
Parameters:
newTime Timestamp.
See also:
setTimeZone() TimeZone::localIsDST()

void Ionflux::Tools::DateTime::setLocalTime const DateTime newTime  )  [virtual]
 

Set local time.

Set the local date and time represented by this DateTime object.

Note:
This function will attempt to determine the DST state automatically. Note that DST state is ambiguous during one hour of the year (see TimeZone::localIsDST() for details on how this case is handled). The source datetime will be treated as local time, regardless of its time zone setting. If you want to set local time from another equivalent local time (i.e. both times represent the same UTC time), you should use standard assignment or setTime() instead of this function.
Parameters:
newTime Source datetime.
See also:
setTimeZone() setTime() TimeZone::localIsDST()

void Ionflux::Tools::DateTime::setLocalTime int  newYear,
int  newMonth,
int  newDay,
int  newHour,
int  newMinute,
int  newSecond,
bool  newDSTState
[virtual]
 

Set local time.

Set the local date and time represented by this DateTime object.

Parameters:
newYear Year.
newMonth Month (1...12).
newDay Day of month (1...31).
newHour Hour (0...23).
newMinute (0...59).
newSecond (0...59).
newDSTState Whether this local time represents daylight saving time.
See also:
setTimeZone()

void Ionflux::Tools::DateTime::setLocalTime const std::string &  newTime,
bool  newDSTState
[virtual]
 

Set local time.

Set the local date and time represented by this DateTime object.

Parameters:
newTime Timestamp.
newDSTState Whether this local time represents daylight saving time.
See also:
setTimeZone()

void Ionflux::Tools::DateTime::setLocalTime const DateTime newTime,
bool  newDSTState
[virtual]
 

Set local time.

Set the local date and time represented by this DateTime object.

Note:
The source datetime will be treated as local time, regardless of its time zone setting. If you want to set local time from another equivalent local time (i.e. both times represent the same UTC time), you should use standard assignment or setTime() instead of this function.
Parameters:
newTime Source datetime.
newDSTState Whether this local time represents daylight saving time.
See also:
setTimeZone() setTime()

void Ionflux::Tools::DateTime::setTime int  newYear,
int  newMonth,
int  newDay,
int  newHour,
int  newMinute,
int  newSecond
[virtual]
 

Set time.

Set the date and time (UTC) represented by this DateTime object.

Parameters:
newYear Year.
newMonth Month (1...12).
newDay Day of month (1...31).
newHour Hour (0...23).
newMinute (0...59).
newSecond (0...59).
See also:
setLocalTime()

void Ionflux::Tools::DateTime::setTime const DateTime newTime  )  [virtual]
 

Set time.

Set the date and time (UTC) represented by this DateTime object.

Parameters:
newTime DateTime object.
See also:
setLocalTime()

void Ionflux::Tools::DateTime::setTime const std::string &  newTime  )  [virtual]
 

Set time.

Set the date and time (UTC) represented by this DateTime object.

Parameters:
newTime Timestamp.
See also:
setLocalTime()

void Ionflux::Tools::DateTime::setTime tm  newTime  )  [virtual]
 

Set time.

Set the date and time (UTC) represented by this DateTime object.

Parameters:
newTime Broken down calendar time.
See also:
setLocalTime()

void Ionflux::Tools::DateTime::setTime TimeTicks  newTime  )  [virtual]
 

Set time.

Set the date and time (UTC) represented by this DateTime object.

Parameters:
newTime Number of UTC seconds since 0001-01-01 00:00:00.
See also:
setLocalTime()

void Ionflux::Tools::DateTime::setTime time_t  newTime  )  [virtual]
 

Set time.

Set the date and time (UTC) represented by this DateTime object.

Parameters:
newTime POSIX timestamp.
See also:
setLocalTime()

void Ionflux::Tools::DateTime::setTimeZone const std::string &  newTimeZone  )  [virtual]
 

Set time zone.

Sets the time zone of the local time by alias name. If no time zone of the specified alias name is found, UTC is assumed.

Parameters:
newTimeZone Time zone alias name.

void Ionflux::Tools::DateTime::setTimeZone const TimeZone newTimeZone,
bool  newManage
[virtual]
 

Set time zone.

Sets the time zone of the local time to specified TimeZone object.

Parameters:
newTimeZone Time zone.
newManage Whether allocated memory for the TimeZone object should be managed.

DateTime & Ionflux::Tools::DateTime::shift int  shiftSeconds  )  [virtual]
 

Shift DateTime.

Shifts a DateTime by a specified amount of seconds. (This may be used for TimeZone transformations or DateTime arithmetic.)

Parameters:
shiftSeconds Amount of seconds to shift this DateTime.
Returns:
Datetime shifted by specified amount of seconds.

void Ionflux::Tools::DateTime::updateBrokenDownTime int  tickOffset  )  [protected, virtual]
 

Update broken down calendar time from ticks.

Updates the broken down calendar time from the UTC ticks. An additional offset may be specified to calculate local time.

Parameters:
tickOffset Tick offset.

void Ionflux::Tools::DateTime::updateTicks  )  [protected, virtual]
 

Update ticks from broken down calendar time.


Member Data Documentation

int Ionflux::Tools::DateTime::day [protected]
 

Broken down time: Day of month (1...31).

std::vector<const TimeZone *> Ionflux::Tools::DateTime::defaultTimeZones [protected]
 

Vector of default time zones.

bool Ionflux::Tools::DateTime::dstState [protected]
 

Broken down time: DST flag.

int Ionflux::Tools::DateTime::hour [protected]
 

Broken down time: Hour (0...23).

const int Ionflux::Tools::DateTime::LEAP_MONTH = 2 [static]
 

Leap month.

bool Ionflux::Tools::DateTime::manageTimeZone [protected]
 

Time zone memory management flag.

int Ionflux::Tools::DateTime::minute [protected]
 

Broken down time: Minute (0...59).

int Ionflux::Tools::DateTime::month [protected]
 

Broken down time: Month (1...12).

const char * Ionflux::Tools::DateTime::MONTH_NAME [static]
 

Initial value:

 {
    "January", "February", "March", "April", "May", "June", "July", "August",
    "September", "October", "November", "December"}
Month names.

const char * Ionflux::Tools::DateTime::MONTH_NAME_SHORT [static]
 

Initial value:

 {
    "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", 
    "Nov", "Dec"}
Month names (short).

const int Ionflux::Tools::DateTime::NUM_DAYS [static]
 

Initial value:

 {
    0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
    0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}
Number of days up to the beginning of the first day of month j + 1 for non-leap years (NUM_DAYS[0.

..11]) and leap years (NUM_DAYS[12...23]).

const TimeTicks Ionflux::Tools::DateTime::POSIX_EPOCH = 62135596800LL [static]
 

Start tick count for POSIX epoch.

const TimeTicks Ionflux::Tools::DateTime::REF_SUNDAY = 63223891200LL [static]
 

Reference ticks of a sunday.

int Ionflux::Tools::DateTime::second [protected]
 

Broken down time: Second (0...59).

TimeTicks Ionflux::Tools::DateTime::ticks [protected]
 

Number of UTC seconds since 0001-01-01 00:00:00.

const TimeTicks Ionflux::Tools::DateTime::TICKS_100Y = 3155673600LL [static]
 

Leap year neutral tick step: 100 years.

const TimeTicks Ionflux::Tools::DateTime::TICKS_1D = 86400LL [static]
 

Ticks per day.

const TimeTicks Ionflux::Tools::DateTime::TICKS_1Y = 31536000LL [static]
 

Leap year neutral tick step: 1 year.

const TimeTicks Ionflux::Tools::DateTime::TICKS_3Y = 94608000LL [static]
 

Leap year neutral tick step: 3 years.

const TimeTicks Ionflux::Tools::DateTime::TICKS_400Y = 12622780800LL [static]
 

Leap year neutral tick step: 400 years.

const TimeTicks Ionflux::Tools::DateTime::TICKS_4Y = 126230400LL [static]
 

Leap year neutral tick step: 4 years.

std::string Ionflux::Tools::DateTime::timestamp [protected]
 

Timestamp (string representation, "YYYY-MM-DD HH:MM:SS").

const std::string Ionflux::Tools::DateTime::TIMESTAMP_DATE_SEP = "-" [static]
 

Timestamp date separator.

const std::string Ionflux::Tools::DateTime::TIMESTAMP_DATETIME_SEP = " " [static]
 

Timestamp datetime separator.

const std::string Ionflux::Tools::DateTime::TIMESTAMP_TIME_SEP = ":" [static]
 

Timestamp time separator.

const TimeZone* Ionflux::Tools::DateTime::timeZone [protected]
 

Local time zone.

const TimeZone Ionflux::Tools::DateTime::TZ_EGYPT [static]
 

Time zone: Egypt (UTC+02).

const TimeZone Ionflux::Tools::DateTime::TZ_EUROPE_CENTRAL [static]
 

Time zone: Europe/Central (CET/CEST).

const TimeZone Ionflux::Tools::DateTime::TZ_EUROPE_EASTERN [static]
 

Time zone: Europe/Eastern (EET/EEST).

const TimeZone Ionflux::Tools::DateTime::TZ_EUROPE_WESTERN [static]
 

Time zone: Europe/Western (WET/WEST).

const TimeZone Ionflux::Tools::DateTime::TZ_GMT [static]
 

Time zone: GMT.

const TimeZone Ionflux::Tools::DateTime::TZ_RUSSIA_WESTERN [static]
 

Time zone: Russia/Western (UTC+03).

const TimeZone Ionflux::Tools::DateTime::TZ_UK [static]
 

Time zone: United Kingdom (WET/BST).

const TimeZone Ionflux::Tools::DateTime::TZ_USA_ALASKA [static]
 

Time zone: USA/Alaska (AKST/AKDT).

const TimeZone Ionflux::Tools::DateTime::TZ_USA_CENTRAL [static]
 

Time zone: USA/Central (CST/CDT).

const TimeZone Ionflux::Tools::DateTime::TZ_USA_EASTERN [static]
 

Time zone: USA/Eastern (EST/EDT).

const TimeZone Ionflux::Tools::DateTime::TZ_USA_MOUNTAIN [static]
 

Time zone: USA/Mountain (MST/MDT).

const TimeZone Ionflux::Tools::DateTime::TZ_USA_PACIFIC [static]
 

Time zone: USA/Pacific (PST/PDT).

const TimeZone Ionflux::Tools::DateTime::TZ_UTC [static]
 

Time zone: UTC.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_M0100 [static]
 

Time zone: UTC-0100.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_M0200 [static]
 

Time zone: UTC-0200.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_M0300 [static]
 

Time zone: UTC-0300.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_M0400 [static]
 

Time zone: UTC-0400.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_M0500 [static]
 

Time zone: UTC-0500.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_M0600 [static]
 

Time zone: UTC-0600.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_M0700 [static]
 

Time zone: UTC-0700.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_M0800 [static]
 

Time zone: UTC-0800.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_M0900 [static]
 

Time zone: UTC-0900.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_M1000 [static]
 

Time zone: UTC-1000.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_M1100 [static]
 

Time zone: UTC-1100.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_M1200 [static]
 

Time zone: UTC-1100.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0100 [static]
 

Time zone: UTC+0100.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0200 [static]
 

Time zone: UTC+0200.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0300 [static]
 

Time zone: UTC+0300.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0330 [static]
 

Time zone: UTC+0330.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0400 [static]
 

Time zone: UTC+0400.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0430 [static]
 

Time zone: UTC+0430.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0500 [static]
 

Time zone: UTC+0500.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0530 [static]
 

Time zone: UTC+0530.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0545 [static]
 

Time zone: UTC+0545.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0600 [static]
 

Time zone: UTC+0600.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0630 [static]
 

Time zone: UTC+0630.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0700 [static]
 

Time zone: UTC+0700.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0800 [static]
 

Time zone: UTC+0800.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0900 [static]
 

Time zone: UTC+0900.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P0930 [static]
 

Time zone: UTC+0930.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P1000 [static]
 

Time zone: UTC+1000.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P1100 [static]
 

Time zone: UTC+1100.

const TimeZone Ionflux::Tools::DateTime::TZ_UTC_P1200 [static]
 

Time zone: UTC+1100.

int Ionflux::Tools::DateTime::utcOffset [protected]
 

Broken down time: UTC offset (minutes).

int Ionflux::Tools::DateTime::weekDay [protected]
 

Broken down time: Day of week (0...6, where 0 = Sunday).

const char * Ionflux::Tools::DateTime::WEEKDAY_NAME [static]
 

Initial value:

 {
    "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", 
    "Saturday"}
Weekday names.

const char * Ionflux::Tools::DateTime::WEEKDAY_NAME_SHORT [static]
 

Initial value:

 {
    "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}
Weekday names (short).

Year Ionflux::Tools::DateTime::year [protected]
 

Broken down time: Year.

int Ionflux::Tools::DateTime::yearDay [protected]
 

Broken down time: Day of year (1...366).


The documentation for this class was generated from the following files:
Generated on Tue Mar 14 21:08:03 2006 for Ionflux Tools Class Library (iftools) by  doxygen 1.4.6