Tools.h++ Class Reference

Table Of Contents
RWTValOrderedVector<RWTime> v(5000, RWTime());
Thanks to the smart allocation scheme of the standard collections, the above declaration will
result in only one call to the default constructor followed by 5000 invocations of the copy
constructor. In the case of RWTime, the copy constructor amounts to an assignment of one long
to another, resulting in faster creation than the simple array.
Persistence
Simple
Example
This example constructs a current time, and the time when Daylight-Saving Time starts in the
year 1990. It then prints them out.
#include <rw/rwtime.h>
#include <rw/rwdate.h>
#include <rw/rstream.h>
main(){
RWTime t; // Current time
RWTime d(RWTime::beginDST(1990, RWZone::local()));
cout << "Current time: " << RWDate(t) << " " << t <<
endl;
cout << "Start of DST, 1990: " << RWDate(d) << " " << d <<
endl;
}
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.
RWTime(unsigned long s);
Constructs a time with s seconds since 00:00:00 January 1, 1901 UTC. If s==0, an invalid
time is constructed. Note that for small s this may be prior to January 1, 1901 in your
time zone.