If you're using MFC then use the CTime and CTimeSpan classes - you can compare two date/times using the comparison operators '<' and '>', etc.
If you're using ANSI style C/C++, then you can use the [tt]difftime()[/tt] function to get the time difference between two [tt]time_t[/tt] structures:
[tt]time_t nowTime;
time(&nowTime);
gmtime(&nowTime); // get the current GMT time
// assume 'oldTime' is some older time variable
// already initialized
double diff = difftime(nowTime,oldTime);[/tt]
actually, a time_t value is simply the number of seconds since jan 1st, 1970. You can get the difference between two time_t values in seconds like this:
[tt]unsigned diff = (unsigned)t1-(unsigned)t2;[/tt]
where t1 is a later time than t2. Also you can compare them:
[tt]if ((unsigned)t1 > (unsigned)t2) {}[/tt]
programmer (prog'ram'er), n A hot-headed, anorak wearing, pimple-faced computer geek.