std::difftime
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody>| Déclaré dans l'en-tête <ctime>
|
||
double difftime( time_t time2, time_t time1 ); |
||
Calcule la différence entre deux fois civiles comme des objets
time_t (time2 - time1) en quelques secondes . Original:
Computes difference between two calendar times as
time_t objects (time2 - time1) in seconds. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Paramètres
| time1, time2 | - | fois à comparer
Original: times to compare The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Retourne la valeur
Différence entre deux heures en quelques secondes
Original:
Difference between two times in seconds
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Exemple
#include <iostream>
#include <ctime>
int main()
{
std::time_t start = std::time(NULL);
volatile double d;
for(int n=0; n<10000; ++n)
for(int m=0; m<100000; ++m)
d += d*n*m; // some time-consuming operation
std::cout << "Wall time passed: "
<< std::difftime(std::time(NULL), start) << " s.\n";
}
Résultat :
Wall time passed: 7 s.
Voir aussi
(C++11) |
un intervalle de temps Original: a time interval The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe générique) |
C documentation for difftime
|