|
|
This tutorial describes a C++ component called Time(3C++) which allows you to deal with time in a much more natural and convenient fashion. The following Time(3C++) program is functionally equivalent to the C program above:
#include <Time.h> #include <iostream.h> main(){ Time result = make_time("now") + Duration::days(30); cout << result << endl; }
Notice that the program is short and transparently correct. Things that are hard to do using the standard facilities are easy to do using Time(3C++). For example, we can display the result in a different timezone:
cout << result.make_string(Place::pacific()) << endl;
and we can even control the output format:
cout << result.make_string("%a %b %E, %Y\ n", Place::pacific());
As a matter of fact, Time(3C++) adds little if any new functionality to the standard facilities beyond the relaxation of the year 2038 limit. By providing a more natural and convenient interface to those facilities, however, Time(3C++) makes it easier for you to write programs--without time errors!
The Time(3C++) section of the manual contains three manpages, plus an introduction. The manpages describe three relatively orthogonal sets of facilities that make up the component:
The next section paves the way for the discussion of individual classes in the sections, ``Duration'' through ``Place'', by giving several examples that illustrate the close relationships among these three types. The section ``Error handling'' discusses the error handling mechanism employed uniformly by all classes.