Class RWTime has member functions to compare, store, restore, add, and subtract RWTimes. An RWTime may return hours, minutes or seconds, or fill a struct tm for any time zone. A complete list of member functions is included in the Class Reference.
For example, here is a code fragment that outputs the hour in local and GMT (UTC) zones, and then the complete local time and date:
RWTime t; cout << t.hour() << endl; // Local hour cout << t.hour(RWZone::utc()) << endl; // UTC hour cout << t.asString('c') << endl; // Local time and date
See the definition for c and other format characters for time under the entry for RWLocale in the Class Reference. The next example shows how you find out when daylight-saving time starts for the current year and local time zone:
RWDate today; // Current date RWTime dstStart = RWTime::beginDST(today.year(), RWZone::local());
In order to ensure that this will give the right results for time zones outside of North America, you should reset RWZone::local() with an RWZoneSimple equipped with an appropriate daylight-saving time rule. For more information see RWZoneSimple in the Class Reference. See the entry for c and other format characters for time in RWLocale in the Class Reference.