Espacios de nombres
Variantes
Acciones

std::chrono::duration::count

De cppreference.com
< cpp‎ | chrono‎ | duration
 
 
 
Utilidades de fecha y hora
(C++11)
(C++11)
Relojes
(C++20)
                                                  
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
Calendarios
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
Husos horarios
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
Fecha y hora estilo C
 
std::chrono::duration
Las funciones miembro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
duration::count
Terceros funciones
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Clases de ayuda
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
constexpr rep count() const;
Devuelve el número de garrapatas durante este tiempo .
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.

Contenido

[editar] Parámetros

(Ninguno)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Valor de retorno

El número de garrapatas durante este tiempo .
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.

[editar] Ejemplo

#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";       
}

Salida:

3 ms duration has 3 ticks
6000 us duration has 6000 ticks
3.5 30Hz duration has 3.5 ticks

[editar] Ver también

Convierte una duración a otra, con un intervalo de tic diferente.
(plantilla de función) [editar]