std::chrono::duration::count
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> constexpr rep count() const; |
||
Retourne le nombre de tiques pendant cette durée .
Original:
Returns the number of ticks for this duration.
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
(Aucun)
Original:
(none)
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.
Retourne la valeur
Le nombre de tiques pendant cette durée .
Original:
The number of ticks for this duration.
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 <chrono>
#include <iostream>
int main()
{
std::chrono::milliseconds ms{3}; // 3 milliseconds
// 6000 microseconds constructed from 3 milliseconds
std::chrono::microseconds us = 2*ms;
// 30Hz clock using fractional ticks
std::chrono::duration<double, std::ratio<1, 30>> hz30(3.5);
std::cout << "3 ms duration has " << ms.count() << " ticks\n"
<< "6000 us duration has " << us.count() << " ticks\n"
<< "3.5 30Hz duration has " << hz30.count() << " ticks\n";
}
Résultat :
3 ms duration has 3 ticks
6000 us duration has 6000 ticks
3.5 30Hz duration has 3.5 ticks
Voir aussi
convertit une durée à l'autre, avec un intervalle tic différent Original: converts a duration to another, with a different tick interval The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |