Tools.h++ Class Reference

Table Of Contents
all, then the local zone instance will use U.S. (RWZone::NoAm) daylight-saving time rules.
Note for developers outside North America: for some time zones this default will not be correct
because these time zones rely on the C standard global variable _daylight. This variable is set
whenever any alternate time zone rule is available, whether it represents daylight-saving time or
not. Also the periods of history affected by daylight-saving time may be different in your time
zone from those in North America, causing the North American rule to be erroneously invoked.
The best way to ensure that these default time zones are correct is to construct an RWZoneSimple
using an appropriate RWDaylightRule and initialize RWZone::local() and RWZone::std() with
this value.
Other instances of RWZoneSimple may be constructed to represent other time zones, and may be
installed globally using RWZone static member functions RWZone::local(const RWZone*) and
RWZone::standard(const RWZone*).
Persistence
None
Examples
To install US Central time as your global "local" time use:
RWZone::local(new RWZoneSimple(RWZone::USCentral));
To install Hawaiian time (where daylight-saving time is not observed) one would say,
RWZone::local(new RWZoneSimple(RWZone::Hawaii, RWZone::NoDST));
Likewise for Japan:
RWZone::local(new RWZoneSimple(RWZone::Japan, RWZone::NoDST));
For France:
RWZone::local(new RWZoneSimple(RWZone::Europe, RWZone::WeEu));
Here are the rules used internally for the RWZone::NoAm and RWZone::WeEu values of
RWZone::DstRule:
// last Sun in Apr to last in Oct:
const RWDaylightRule usRuleAuld =
{ 0, 0000, 1, { 3, 4, 0, 120 }, { 9, 4, 0, 120 } };
// first Sun in Apr to last in Oct
const RWDaylightRule usRule67 =
{ &usRuleAuld, 1967, 1, { 3, 0, 0, 120 }, { 9, 4, 0, 120 } };
// first Sun in Jan to last in Oct:
const RWDaylightRule usRule74 =
{ &usRule67, 1974, 1, { 0, 0, 0, 120 }, { 9, 4, 0, 120 } };
// last Sun in Feb to last in Oct
const RWDaylightRule usRule75 =
{ &usRule74, 1975, 1, { 1, 4, 0, 120 }, { 9, 4, 0, 120 } };