The latest version of this topic can be found at 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
COleDateTimeobjects.Set one of the
COleDateTimeobjects to the current time.Perform some time-consuming task.
Set the other
COleDateTimeobject 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;