Tools.h++ Class Reference

Table Of Contents
// last Sun in Apr to last in Oct
const RWDaylightRule usRule76 =
{ &usRule75, 1976, 1, { 3, 4, 0, 120 }, { 9, 4, 0, 120 } };
// first Sun in Apr to last in Oct
const RWDaylightRule usRuleLate =
{ &usRule76, 1987, 1, { 3, 0, 0, 120 }, { 9, 4, 0, 120 } };
// last Sun in Mar to last in Sep
const RWDaylightRule euRuleLate =
{ 0, 0000, 1, { 2, 4, 0, 120 }, { 8, 4, 0, 120 } };
Given these definitions,
RWZone::local(new RWZoneSimple(RWZone::USCentral, &usRuleLate));
is equivalent to the first example given above and repeated here:
RWZone::local(new RWZoneSimple(RWZone::USCentral));
Daylight-saving time systems that cannot be represented with RWDaylightRule and
RWZoneSimple must be modeled by deriving from RWZone and implementing its virtual
functions.
For example, under Britain's Summer Time rules, alternate timekeeping begins the morning after
the third Saturday in April, unless that is Easter (in which case it begins the week before) or unless
the Council decides on some other time for that year. In some years Summer Time has been two
hours ahead, or has extended through winter without a break. British Summer Time clearly
deserves an RWZone class all its own.
Constructors
RWZoneSimple(RWZone::StdZone zone,
RWZone::DstRule = RWZone::NoAm);
Constructs an RWZoneSimple instance using internally held RWDaylightRules. This is the
simplest interface to RWZoneSimple. The first argument is the time zone for which an
RWZoneSimple is to be constructed. The second argument is the daylight-saving time rule
which is to be followed.
RWZoneSimple(const RWDaylightRule* rule,
long tzoff, const RWCString& tzname,
long altoff, const RWCString& altname);
Constructs an RWZoneSimple instance which daylight-saving time is computed according
to the rule specified. Variables tzoff and tzname are the offset from UTC (in seconds,
positive if west of 0 degrees longitude) and the name of standard time. Arguments altoff and
altname are the offset (typically equal to tzoff - 3600) and name when daylight-saving time
is in effect. If rule is zero, daylight-saving time is not observed.
RWZoneSimple(long tzoff, const RWCString& tzname);