Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module User's Guide

3.4 Setting the Time Zone

Classes RWDateTime and RWTime both use UTC because it is the international standard and useful in calculations, but it is not the usual time reference people use in their daily lives. Our sense of time is usually based upon a local time that may or may not observe Daylight Saving Time (DST) conventions. Depending on the date, of course, DST may or may not be in effect.

When we create an RWDateTime or an RWTime object to represent the current time, the library obtains the current UTC time directly from the operating system. However, when we create an RWDateTime or an RWTime object for some specific time, that time is unlikely to actually be UTC. More likely, the time we want will be some other time zone, and we must specify which time zone for RWDateTime or RWTime to do their job, or even print out the time. So by default, RWDateTime and RWTime both use local time, set by RWZone::local().

How does the library determine the local time? The Unix operating system provides ways to set the local time zone and to establish whether DST is locally observed. Class RWTime uses various system calls to determine these values and sets itself accordingly. Class RWTime should function properly in North America or places where DST is not observed. In places not governed by United States DST rules, you may need to re-initialize the local time zone-----see RWZone in the Essential Tools Module Reference Guide.

Users of the various Windows operating systems may have to set the time switches manually. How you do this depends on your compiler. If you do nothing, the class will function properly for local time, but may not give the proper UTC because the computer has no way of knowing the offset from local time to UTC. For further information, see the documentation for function tzset()or _tzset() in your compiler's runtime library reference.

Finally, it is essential that your computer's system clock be set and functioning correctly. If you are using a PC, be sure the batteries that power the system clock are charged.

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.