Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide


Module:  Essential Tools Module   Group:  Internationalization

Does not inherit

Local Index



#include <time.h>
#include <rw/zone.h>
(abstract base class)


RWZone is an abstract base class. It defines an interface for time zone issues such as whether or not Daylight Saving Time is in use, the names and offsets from GMT (also known as UTC) for both standard and Daylight Saving Times, and the start and stop dates for Daylight Saving Time, if used. Note that because it is an abstract base class, there is no way to actually enforce these goals -- the description here is merely the model of how a class derived from RWZone should act.

Most programs interact with RWZone only by passing an RWZone reference to an RWDateTime, RWDate, or RWTime member function that expects one.

Daylight saving-time rules are volatile, often reflecting geographical and political changes. In some cases, the hard-coded table-driven struct RWDaylightRule does not accurately reflect the locale installed on your machine. RWZone::os() creates a new RWZoneSimple containing the daylight rule discovered from the underlying operating system. The onus of correctness for this DST rule is on the operating system itself.

In many cases, you may want more explicit control of the DST rule for the intended RWZoneSimple. If so, you can build a DST rule with arbitrary begin and end times (see the RWDaylightRule below), and provide it as a parameter to RWZoneSimple.




To install the underlying system's DST rule as your global local time, use:


enum DstRule {//supported Daylight Savings Time jurisdictions:
  NoDST,      // Daylight Savings Time never observed
  NoAm,       // North America (US, Canada)
  WeEu,       // Much of Western Europe, excluding the UK
  OfficialEU  // Official European Union DST rules.
enum StdZone {
  NewZealand = -12,    CarolineIslands,     MarianaIslands,
  Japan,               China,               Java,
  Kazakh,              Pakistan,            CaspianSea,
  Ukraine,             Nile,                Europe,
  Greenwich,           Azores,              Oscar,
  Greenland,           Atlantic,            USEastern,
  USCentral,           USMountain,          USPacific,
  Yukon,               Hawaii,              Bering

Public Member Functions

virtual int
timeZoneOffset() const = 0;
virtual int
altZoneOffset() const = 0; 
virtual RWBoolean
daylightObserved() const = 0; 
virtual RWBoolean
isDaylight(const struct tm* tspec) const = 0; 
virtual void
getBeginDaylight(struct tm*) const = 0; 
virtual void
getEndDaylight  (struct tm*) const = 0; 
virtual RWCString
timeZoneName() const = 0; 
virtual RWCString
altZoneName() const = 0; 

Static Public Member Functions

static const RWZone&
static const RWZone&
static const RWZone&
static const RWZone&
static const RWZone*
local(const RWZone*);
static const RWZone*
standard(const RWZone*);
static constRWDaylightRule*
dstRule(DstRule rule = NoAm); 

Previous fileTop of DocumentContentsIndex pageNext file

©2004 Copyright Quovadx, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.