Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The following procedure shows how to calculate the difference between two CTime objects and get a CTimeSpan result.
To calculate elapsed time
Use the CTime and CTimeSpan objects to calculate the elapsed time, as follows:
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.