Tools.h++ Manual
104011 Tandem Computers Incorporated 21-185
21
RWTime
Synopsis
#include <rw/rwtime.h>
RWTime a; // Construct with current time
Description Class
RWTime
represents a time, stored as the number of seconds since 00:00:00
January 1901 UTC. See “Setting the time zone” on page 1 in Chapter 7, “Using
Class RWTime,” for how to set the time zone for your compiler.
Caution – Failure to do this may result in UTC (GMT) times being wrong.
Output formatting is now done using an
RWLocale
object. The default locale
formats according to U.S. conventions.
Example
Program output
Current time: 03/22/91 15:01:40
Start of DST, 1990: 05/01/90 02:00:00
Public constructors
RWTime();
Default constructor. Constructs a time with the present time.
RWTime(const RWTime&);
Copy constructor, generated by the compiler.
RWTime(unsigned long s);
Constructs a time with s seconds since 00:00:00 January 1, 1901 UTC.
#include <rw/rwtime.h>
#include <rw/rstream.h>
main()
{
RWTime t; // Current time
RWTime d(RWTime::beginDST(1990);
cout << "Current time: " << RWDate(t) << " " << t << endl;
cout << "Start of DST, 1990: " << RWDate(d) << " " << d << endl;
}
!