Tools.h++ Manual
21-236 104011 Tandem Computers Incorporated
21
RWZoneSimple
RWZoneSimple
|
RWZone
Synopsis
#include <time.h>
#include <rw/zone.h>
RWZoneSimple myZone(USCentral)
;
Description
RWZoneSimple
is an implementation of the abstract interface defined by class
RWZone
. It implements a simple daylight savings time rule sufficient to
represent all historical U.S. conventions and many European and Asian
conventions. It is table-driven and depends on parameters given by class
RWDaylightRule
.
Direct use of
RWDaylightRule
affords the most general interface to
RWZoneSimple
. However, a much simpler programmatic interface is offered,
as illustrated by the examples below.
Three instances of
RWZoneSimple
are automatically constructed at program
startup, to represent UTC, Standard, and local time. They are
available via calls to the static member functions
RWZone::utc(),
RWZone::standard()
, and
RWZone::local()
, respectively. These are set
up according to the time zone facilities provided in the execution environment
(typically defined by the environment variable
TZ
). By default, if DST is
observed at all, then the local zone instance will use U.S. (
RWZone::NoAm
)
daylight savings time rules.
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*)
.
Examples To install US Central time as your global “local” time use:
RWZone::local(new RWZoneSimple(RWZone::USCentral))
;
To install Hawaiian time (where daylight savings time is not observed) one
would say,
RWZone::local(new RWZoneSimple(RWZone::Hawaii,
RWZone::NoDST))
;