Elapsed Time: Automation Classes
This procedure shows how to calculate the difference between two CTime objects and get a CTimeSpan result.
To calculate elapsed time
Create two COleDateTime objects.
Set one of the COleDateTime objects to the current time.
Perform some time-consuming task.
Set the other COleDateTime object to the current time.
Take the difference between the two times.
COleDateTime timeStart, timeEnd; timeStart = COleDateTime::GetCurrentTime(); // ... perform time-consuming task timeEnd = COleDateTime::GetCurrentTime(); COleDateTimeSpan spanElapsed = timeEnd - timeStart;