Setting the Time Zone
Class
RWDateTime uses 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 object to represent the current time, the library obtains the current UTC time directly from the operating system. However, when we create an
RWDateTime 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 to do its job, or even print out the time. So by default,
RWDateTime 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. 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.