ionflux.org | Impressum

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

Time zone. More...

#include <TimeZone.hpp>

Collaboration diagram for Ionflux::Tools::TimeZone:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TimeZone ()
 Constructor.
 TimeZone (int initOffset)
 Constructor.
 TimeZone (int initOffset, const std::string &initNameNormal, const std::string &initNameDST, const std::string &initShortNameNormal, const std::string &initShortNameDST, const std::string &initAliases)
 Constructor.
 TimeZone (int initOffset, const DSTSwitchingRule &initToDST, const DSTSwitchingRule &initToNormal)
 Constructor.
 TimeZone (int initOffset, const DSTSwitchingRule &initToDST, const DSTSwitchingRule &initToNormal, const std::string &initNameNormal, const std::string &initNameDST, const std::string &initShortNameNormal, const std::string &initShortNameDST, const std::string &initAliases)
 Constructor.
virtual ~TimeZone ()
 Destructor.
virtual void setOffset (int newOffset)
 Set UTC offset.
virtual void setNameNormal (const std::string &newNameNormal)
 Set time zone name (normal time).
virtual void setNameDST (const std::string &newNameDST)
 Set time zone name (DST).
virtual void setShortNameNormal (const std::string &newNameNormal)
 Set time zone name (normal time).
virtual void setShortNameDST (const std::string &newNameDST)
 Set time zone name (DST).
virtual void setAliases (const std::string &newAliases)
 Set time zone alias names.
virtual void setDSTRules (const DSTSwitchingRule &newToDST, const DSTSwitchingRule &newToNormal)
 Set DST switching rules.
virtual bool isDST (const DateTime &utcDT) const
 Get current DST state (UTC).
virtual bool localIsDST (const DateTime &localDT) const
 Get current DST state (local time).
virtual int getCurrentOffset (const DateTime &utcDT) const
 Get current UTC offset.
virtual const DSTSwitchingRulegetDSTRule (bool ruleFlag) const
 Get DST rule.
DateTime getSwitchDT (Year year, const DSTSwitchingRule &rule) const
 Get switch date.
virtual int getOffset () const
 Get UTC offset.
virtual std::string getNameNormal () const
 Get time zone name (normal time).
virtual std::string getNameDST () const
 Get time zone name (DST).
virtual std::string getShortNameNormal () const
 Get time zone name (normal time).
virtual std::string getShortNameDST () const
 Get time zone name (DST).
virtual std::string getAliases () const
 Get time zone alias names.
virtual bool hasAlias (const std::string &checkAlias) const
 Check alias name.
virtual void enableDST (bool enableFlag)
 Enable or disable DST.

Static Public Attributes

static const DSTSwitchingRule DSR_TO_DST_EUROPE_WESTERN
 DST switching rule: Europe/Western (to DST).
static const DSTSwitchingRule DSR_TO_NORMAL_EUROPE_WESTERN
 DST switching rule: Europe/Western (to normal).
static const DSTSwitchingRule DSR_TO_DST_EUROPE_CENTRAL
 DST switching rule: Europe/Central (to DST).
static const DSTSwitchingRule DSR_TO_NORMAL_EUROPE_CENTRAL
 DST switching rule: Europe/Central (to normal).
static const DSTSwitchingRule DSR_TO_DST_EUROPE_EASTERN
 DST switching rule: Europe/Eastern (to DST).
static const DSTSwitchingRule DSR_TO_NORMAL_EUROPE_EASTERN
 DST switching rule: Europe/Eastern (to normal).
static const DSTSwitchingRule DSR_TO_DST_USA
 DST switching rule: USA (to DST).
static const DSTSwitchingRule DSR_TO_NORMAL_USA
 DST switching rule: USA (to normal).
static const DSTSwitchingRule DSR_TO_DST_EGYPT
 DST switching rule: Egypt (to DST).
static const DSTSwitchingRule DSR_TO_NORMAL_EGYPT
 DST switching rule: Egypt (to normal).

Protected Attributes

int offset
 UTC offset (minutes).
bool useDST
 DST flag (true if DST rules are defined).
DSTSwitchingRule toDST
 Rule for switching to DST.
DSTSwitchingRule toNormal
 Rule for switching to normal time.
std::string nameNormal
 Name of the time zone (normal time).
std::string nameDST
 Name of the time zone (DST).
std::string shortNameNormal
 Short name of the time zone (normal time).
std::string shortNameDST
 Short name of the time zone (DST).
std::string aliases
 Alias names for the time zone.

Detailed Description

Time zone.

Provides information required for the time zone transformation of datetimes, such as UTC offset and DST switching rules.


Constructor & Destructor Documentation

Ionflux::Tools::TimeZone::TimeZone  ) 
 

Constructor.

Construct new TimeZone object.

Ionflux::Tools::TimeZone::TimeZone int  initOffset  ) 
 

Constructor.

Construct new TimeZone object.

Parameters:
initOffset UTC offset (minutes).

Ionflux::Tools::TimeZone::TimeZone int  initOffset,
const std::string &  initNameNormal,
const std::string &  initNameDST,
const std::string &  initShortNameNormal,
const std::string &  initShortNameDST,
const std::string &  initAliases
 

Constructor.

Construct new TimeZone object.

Parameters:
initOffset UTC offset (minutes).
initNameNormal Time zone name (normal time).
initNameDST Time zone name (DST).
initShortNameNormal Time zone short name (normal time).
initShortNameDST Time zone short name (DST).
initAliases Time zone alias names.

Ionflux::Tools::TimeZone::TimeZone int  initOffset,
const DSTSwitchingRule initToDST,
const DSTSwitchingRule initToNormal
 

Constructor.

Construct new TimeZone object.

Parameters:
initOffset UTC offset (minutes).
initToDST Rule for switching to DST.
initToNormal Rule for switching to normal time.

Ionflux::Tools::TimeZone::TimeZone int  initOffset,
const DSTSwitchingRule initToDST,
const DSTSwitchingRule initToNormal,
const std::string &  initNameNormal,
const std::string &  initNameDST,
const std::string &  initShortNameNormal,
const std::string &  initShortNameDST,
const std::string &  initAliases
 

Constructor.

Construct new TimeZone object.

Parameters:
initOffset UTC offset (minutes).
initToDST Rule for switching to DST.
initToNormal Rule for switching to normal time.
initNameNormal Time zone name (normal time).
initNameDST Time zone name (DST).
initShortNameNormal Time zone short name (normal time).
initShortNameDST Time zone short name (DST).
initAliases Time zone alias names.

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

Destructor.

Destruct TimeZone object.


Member Function Documentation

void Ionflux::Tools::TimeZone::enableDST bool  enableFlag  )  [virtual]
 

Enable or disable DST.

Sets whether to apply daylight saving time switching rules. Passing true enables DST (if rules are defined), passing false disables DST.

Parameters:
enableFlag New DST state.

std::string Ionflux::Tools::TimeZone::getAliases  )  const [virtual]
 

Get time zone alias names.

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

int Ionflux::Tools::TimeZone::getCurrentOffset const DateTime utcDT  )  const [virtual]
 

Get current UTC offset.

Get the UTC offset, in minutes, corrected for DST, for the local time corresponding to the specified UTC DateTime.

Note:
This function is meant for time zone conversion only. If you require this function for a local time instead of UTC, you should use the function DateTime::getUTCOffset() instead.
Parameters:
utcDT DateTime object.
Returns:
The current UTC offset, in minutes.

const DSTSwitchingRule * Ionflux::Tools::TimeZone::getDSTRule bool  ruleFlag  )  const [virtual]
 

Get DST rule.

Return one of the DST rules for this time zone.

Parameters:
ruleFlag Which rule to return.
Returns:
The rule for switching to DST if true is passed, the rule for switching to normal time if false is passed and 0 if no rules are defined.

std::string Ionflux::Tools::TimeZone::getNameDST  )  const [virtual]
 

Get time zone name (DST).

Returns:
The name of the time zone when DST is in effect.

std::string Ionflux::Tools::TimeZone::getNameNormal  )  const [virtual]
 

Get time zone name (normal time).

Returns:
The name of the time zone when normal time is in effect.

int Ionflux::Tools::TimeZone::getOffset  )  const [virtual]
 

Get UTC offset.

Returns:
Nominal UTC offset of this time zone, in minutes.

std::string Ionflux::Tools::TimeZone::getShortNameDST  )  const [virtual]
 

Get time zone name (DST).

Returns:
The name of the time zone when DST is in effect.

std::string Ionflux::Tools::TimeZone::getShortNameNormal  )  const [virtual]
 

Get time zone name (normal time).

Returns:
The name of the time zone when normal time is in effect.

DateTime Ionflux::Tools::TimeZone::getSwitchDT Year  year,
const DSTSwitchingRule rule
const
 

Get switch date.

Creates an exact switch date (UTC) from a DST switching rule for the specified year.

Parameters:
year The year which to apply the DST switching rule to.
rule The DST switching rule to apply.
Returns:
Datetime where the switching from or to DST occurs.

bool Ionflux::Tools::TimeZone::hasAlias const std::string &  checkAlias  )  const [virtual]
 

Check alias name.

Checks whether this time zone has a specified alias name.

Returns:
true if this time zone has the specified alias name, false otherwise.

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

Get current DST state (UTC).

Get current DST state of an UTC datetime in the local time zone.

Note:
This function is meant for time zone conversion only. If you require this function for a local time instead of UTC, you should use the function DateTime::isDST() instead.
Parameters:
utcDT DateTime object.
Returns:
true if the specified UTC DateTime represents daylight saving time in the local time zone, false otherwise.

bool Ionflux::Tools::TimeZone::localIsDST const DateTime localDT  )  const [virtual]
 

Get current DST state (local time).

Get current DST state of a local time.

Note:
DST state for local time is ambiguous during one hour of the year, i.e. when switching from DST to normal time occurs. This function will prefer normal time to DST in this case. Likewise, there is one hour during the year that is skipped, i.e. when switching from normal time to DST occurs. Datetimes in the range of this hour are not valid. If an invalid datetime is specified, the behavior is undefined. Also note that the timezone of localDT, if set at all, will be ignored. Whatever time is stored in localDT will be treated as local time in the time zone of the TimeZone object.
Parameters:
localDT DateTime object.
Returns:
true if the specified DateTime represents daylight saving time, false otherwise.

void Ionflux::Tools::TimeZone::setAliases const std::string &  newAliases  )  [virtual]
 

Set time zone alias names.

Set alias names for this time zone. This is a colon (':') separated list of names that may be used to refer to this time zone.

Note:
It is useful if this is set to a list of names of major cities in the time zone (e.g. "Amsterdam:Paris:Berlin:..."), or an instructive name specifying the geographical region where the time zone applies (e.g. "Central Europe").
Parameters:
newAliases Colon (':') separated list of alias names.

void Ionflux::Tools::TimeZone::setDSTRules const DSTSwitchingRule newToDST,
const DSTSwitchingRule newToNormal
[virtual]
 

Set DST switching rules.

Sets the daylight saving time switching rules.

Parameters:
newToDST Rule for switching to DST.
newToNormal Rule for switching to normal time.

void Ionflux::Tools::TimeZone::setNameDST const std::string &  newNameDST  )  [virtual]
 

Set time zone name (DST).

Set a name for this time zone during DST (e.g. "Central European Summer Time").

Parameters:
newNameDST Time zone name (DST).

void Ionflux::Tools::TimeZone::setNameNormal const std::string &  newNameNormal  )  [virtual]
 

Set time zone name (normal time).

Set a name for this time zone during normal time (e.g. "Central European Time").

Parameters:
newNameNormal Time zone name (normal time).

void Ionflux::Tools::TimeZone::setOffset int  newOffset  )  [virtual]
 

Set UTC offset.

Sets the UTC offset of the time zone (normal time).

Parameters:
newOffset UTC offset (minutes).

void Ionflux::Tools::TimeZone::setShortNameDST const std::string &  newNameDST  )  [virtual]
 

Set time zone name (DST).

Set a name for this time zone during DST (e.g. "CEST").

Parameters:
newNameDST Time zone name (DST).

void Ionflux::Tools::TimeZone::setShortNameNormal const std::string &  newNameNormal  )  [virtual]
 

Set time zone name (normal time).

Set a short name for this time zone during normal time (e.g. "CET").

Parameters:
newNameNormal Time zone name (normal time).


Member Data Documentation

std::string Ionflux::Tools::TimeZone::aliases [protected]
 

Alias names for the time zone.

const DSTSwitchingRule Ionflux::Tools::TimeZone::DSR_TO_DST_EGYPT [static]
 

Initial value:

 {
    DSTSwitchingRule::DSR_TYPE_TO_DST, 4, 5, 5, 0, 0, 0}
DST switching rule: Egypt (to DST).

const DSTSwitchingRule Ionflux::Tools::TimeZone::DSR_TO_DST_EUROPE_CENTRAL [static]
 

Initial value:

 {
    DSTSwitchingRule::DSR_TYPE_TO_DST, 3, 0, 5, 2, 0, 0}
DST switching rule: Europe/Central (to DST).

const DSTSwitchingRule Ionflux::Tools::TimeZone::DSR_TO_DST_EUROPE_EASTERN [static]
 

Initial value:

 {
    DSTSwitchingRule::DSR_TYPE_TO_DST, 3, 0, 5, 3, 0, 0}
DST switching rule: Europe/Eastern (to DST).

const DSTSwitchingRule Ionflux::Tools::TimeZone::DSR_TO_DST_EUROPE_WESTERN [static]
 

Initial value:

 {
    DSTSwitchingRule::DSR_TYPE_TO_DST, 3, 0, 5, 1, 0, 0}
DST switching rule: Europe/Western (to DST).

const DSTSwitchingRule Ionflux::Tools::TimeZone::DSR_TO_DST_USA [static]
 

Initial value:

 {
    DSTSwitchingRule::DSR_TYPE_TO_DST, 4, 0, 1, 2, 0, 0}
DST switching rule: USA (to DST).

const DSTSwitchingRule Ionflux::Tools::TimeZone::DSR_TO_NORMAL_EGYPT [static]
 

Initial value:

 {
    DSTSwitchingRule::DSR_TYPE_TO_NORMAL, 10, 5, 1, 0, 0, 0}
DST switching rule: Egypt (to normal).

const DSTSwitchingRule Ionflux::Tools::TimeZone::DSR_TO_NORMAL_EUROPE_CENTRAL [static]
 

Initial value:

 {
    DSTSwitchingRule::DSR_TYPE_TO_NORMAL, 10, 0, 5, 3, 0, 0}
DST switching rule: Europe/Central (to normal).

const DSTSwitchingRule Ionflux::Tools::TimeZone::DSR_TO_NORMAL_EUROPE_EASTERN [static]
 

Initial value:

 {
    DSTSwitchingRule::DSR_TYPE_TO_NORMAL, 10, 0, 5, 4, 0, 0}
DST switching rule: Europe/Eastern (to normal).

const DSTSwitchingRule Ionflux::Tools::TimeZone::DSR_TO_NORMAL_EUROPE_WESTERN [static]
 

Initial value:

 {
    DSTSwitchingRule::DSR_TYPE_TO_NORMAL, 10, 0, 5, 2, 0, 0}
DST switching rule: Europe/Western (to normal).

const DSTSwitchingRule Ionflux::Tools::TimeZone::DSR_TO_NORMAL_USA [static]
 

Initial value:

 {
    DSTSwitchingRule::DSR_TYPE_TO_NORMAL, 10, 0, 5, 2, 0, 0}
DST switching rule: USA (to normal).

std::string Ionflux::Tools::TimeZone::nameDST [protected]
 

Name of the time zone (DST).

std::string Ionflux::Tools::TimeZone::nameNormal [protected]
 

Name of the time zone (normal time).

int Ionflux::Tools::TimeZone::offset [protected]
 

UTC offset (minutes).

std::string Ionflux::Tools::TimeZone::shortNameDST [protected]
 

Short name of the time zone (DST).

std::string Ionflux::Tools::TimeZone::shortNameNormal [protected]
 

Short name of the time zone (normal time).

DSTSwitchingRule Ionflux::Tools::TimeZone::toDST [protected]
 

Rule for switching to DST.

DSTSwitchingRule Ionflux::Tools::TimeZone::toNormal [protected]
 

Rule for switching to normal time.

bool Ionflux::Tools::TimeZone::useDST [protected]
 

DST flag (true if DST rules are defined).


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