Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWZone

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <time.h>
#include <rw/zone.h>

(abstract base class)

Description

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 RWTime or RWDate member function that expects one.

RWZoneSimple is an implementation of the abstract RWZone interface sufficient to represent U.S. daylight-saving time rules. Three instances of RWZoneSimple are initialized from the global environment at program startup to represent local, standard, and universal time. They are available via calls to the static member functions RWZone::local(), RWZone::standard(), and RWZone::utc(), respectively. See the class RWZoneSimple for details.

Persistence

None

Example

#include <rw/zone.h>
#include <rw/rwtime.h>
#include <rw/rstream.h>

main(){
 RWTime now;
 cout << now.asString('\0', RWZone::local()) << endl;
 cout << now.asString("%x %X", RWZone::utc()) << endl;
 return 0;
}

Enumerations

enum DstRule { NoDST, NoAm, WeEu };
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&
local();
static const RWZone&
os();
static const RWZone&
standard();
static const RWZone&
utc();
static const RWZone*
local(const RWZone*);
static const RWZone*
standard(const RWZone*);
static constRWDaylightRule*
dstRule(DstRule rule = NoAm); 


Previous fileTop of documentContentsIndexNext file
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.