Utility functions
[Outlook Wrapper]

Collaboration diagram for Utility functions:

Defines

#define TZ_EASTERN_US   TEXT("Eastern Standard Time" )
#define TZ_CENTRAL_US   TEXT("Central Standard Time" )
#define TZ_MOUNTAIN   TEXT("Mountain Standard Time")
#define TZ_PACIFIC_US   TEXT("Pacific Standard Time" )
#define TZ_ALASKA   TEXT("Alaska Standard Time" )

Functions

const OlDefaultFolders getDefaultFolderType (const std::wstring &itemType)
const OlItemType getOlItemType (const std::wstring &itemType)
const std::wstring getItemTypeFromOlType (const OlItemType olType)
void manageComErrors (_com_error &e)
const std::wstring getNameFromVersion (std::wstring version)
void doubleToSystemTime (std::wstring &systemDate, const DATE doubleDate, const BOOL toUTC, const bool onlyDate=false)
 Variant time (double) -> System time ("YYYYMMDD" or "YYYYMMDDThhmmssZ") The output value is a string.
void systemTimeToDouble (const std::wstring &dataString, DATE *date, bool onlyDate=false)
 String time ("YYYYMMDDThhmmssZ" or "YYYYMMDD") -> Variant time (double).
void localTimeToUTC (SYSTEMTIME &sysTime)
 Converts 'sysTime' from local time to UTC.
void UTCToLocalTime (SYSTEMTIME &sysTime)
 Converts 'sysTime' from UTC to local time.
bool adjustDSTSettings (TIME_ZONE_INFORMATION *timeZoneInfo, SYSTEMTIME targetTime)
 Correct the DST dates inside timeZoneInfo passed, if necessary.
bool isTZForDSTChange (const std::wstring &tzName)
 Returns true if the passed timezone name is one of the timezones that changed their rule in 2007.
BOOL vBoolToBOOL (VARIANT_BOOL vbool)
 Variant bool (-1/0) to BOOL (1/0).
bool vBoolToBool (VARIANT_BOOL vbool)
 Variant bool (-1/0) to bool (true/false).
VARIANT_BOOL BOOLToVBool (BOOL b)
 BOOL (1/0) to Variant bool (-1/0).

Define Documentation

#define TZ_EASTERN_US   TEXT("Eastern Standard Time" )

Referenced by isTZForDSTChange().


Function Documentation

bool adjustDSTSettings ( TIME_ZONE_INFORMATION *  timeZoneInfo,
SYSTEMTIME  targetTime 
)

Correct the DST dates inside timeZoneInfo passed, if necessary.

In 2007 the DST rules chaged for U.S. and Canada, so we need to adjust the timeZoneInfo if current Timezone is one of the timezones affected by the change of Energy Policy Act of 2005.

See also:
http://en.wikipedia.org/wiki/Energy_Policy_Act_of_2005
Parameters:
timeZoneInfo [IN-OUT] the TIME_ZONE_INFORMATION structure to adjust
targetTime the target date/time analyzed
Returns:
true if the adjustment was done

References OutlookConfig::getCurrentTimezone(), isTZForDSTChange(), and TimeZone::keyName.

Referenced by localTimeToUTC(), and UTCToLocalTime().

void doubleToSystemTime ( wstring &  systemDate,
const DATE  doubleDate,
const BOOL  toUTC,
const bool  onlyDate 
)

Variant time (double) -> System time ("YYYYMMDD" or "YYYYMMDDThhmmssZ") The output value is a string.

It's in UTC based on param 'toUTC'. If onlyDate = true, toUTC is ignored.

Parameters:
systemDate [OUT] the date returned in SystemTime format
doubleDate the input date in variant time format
toUTC TRUE if we want conversion in UTC format (YYYYMMDDThhmmssZ)
onlyDate if true, the output systemTime is in date format "yyyyMMdd" (hours info are cut)

References LIMIT_MAX_DATE, and localTimeToUTC().

Referenced by ClientAppException::formatOriginalDate(), ClientRecurrence::read(), ClientAppException::read(), ClientRecurrence::refresh(), and ClientRecurrence::save().

void localTimeToUTC ( SYSTEMTIME &  sysTime  ) 

Converts 'sysTime' from local time to UTC.

Uses the specific settings for the time zone and daylight saving time that are applied to the 'sysTime' date.

Note:
correction is applied for DST change in the US since 2007.

References adjustDSTSettings().

Referenced by ClientRecurrence::changeDay(), and doubleToSystemTime().

void systemTimeToDouble ( const wstring &  dataString,
DATE date,
bool  onlyDate 
)

String time ("YYYYMMDDThhmmssZ" or "YYYYMMDD") -> Variant time (double).

Automatic conversion from UTC to Local time if input time is UTC. If onlyDate = true, time is not converted to UTC and hour is forced to 00:00.

Parameters:
dataString the input string in System time format
date [OUT] the returned value into VariantTime format
onlyDate if true, time is not converted to UTC and hour is forced to 00:00.

References UTCToLocalTime().

Referenced by ClientRecurrence::changeDay(), DateFilter::execute(), ClientAppException::formatOriginalDate(), ClientRecurrence::read(), ClientRecurrence::refresh(), ClientRecurrence::save(), ClientRecurrence::saveException(), ClientAppException::saveOccurrence(), and setRecurrenceExceptions().

void UTCToLocalTime ( SYSTEMTIME &  sysTime  ) 

Converts 'sysTime' from UTC to local time.

Uses the specific settings for the time zone and daylight saving time that are applied to the 'sysTime' date.

Note:
correction is applied for DST change in the US since 2007.

References adjustDSTSettings().

Referenced by systemTimeToDouble().


Generated on Tue Apr 6 13:00:40 2010 for Funambol Outlook Plug-in Library by  doxygen 1.5.7.1