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 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
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;