The following procedure shows how to calculate the difference between two CTime objects and get a CTimeSpan result.
To calculate elapsed time
CTime startTime = CTime::GetCurrentTime();
// ... perform time-consuming task ...
CTime endTime = CTime::GetCurrentTime();
CTimeSpan elapsedTime = endTime - startTime;
Once you have calculated elapsedTime
, you can use the member functions of CTimeSpan to extract the components of the elapsed-time value.