title
Elapsed Time: General-Purpose Classes | Microsoft Docs
ms.custom
ms.date
11/04/2016
ms.reviewer
ms.suite
ms.technology
ms.tgt_pltfrm
ms.topic
reference
dev_langs
helpviewer_keywords
adding dates
calculating dates and times
dates, calculating intervals
elapsed time, calculating
elapsed time
time, elapsed
intervals, date and time
calculations, date and time
ms.assetid
e5c5d3d2-ce1d-409e-875c-98848434e716
caps.latest.revision
10
author
mikeblome
ms.author
mblome
manager
ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw
Elapsed Time: General-Purpose Classes
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:
[!code-cppNVC_ATLMFC_Utilities#174 ]
Once you have calculated elapsedTime, you can use the member functions of CTimeSpan to extract the components of the elapsed-time value.
Date and Time: General-Purpose Classes