Functions are defined to let you compare ITime objects for equality, inequality, or relative position in time. The following operators are defined: ==, !=, <, <=, >, >=. In the following example, a message is displayed if enough time elapses between the first and second calls to the now() member function:
#include <itime.hpp>
#include <iostream.h>
ITime First(ITime::now());
void main() {
ITime Second=ITime::now();
if (First<Second) // Some time has passed
cout << "You must be debugging me!" << endl;
}
This message usually does not print when the program is run outside of a debugging session. However, if you debug the program and step through each line slowly, the message may be displayed, because the first ITime object is initialized during program initialization (before main is called) while the second ITime object is initialized within main.