Namensräume
Varianten
Aktionen

std::chrono::duration::count

Aus cppreference.com
< cpp‎ | chrono‎ | duration

 
 
 
 
std::chrono::duration
Member-Funktionen
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::duration
duration::operator=
duration::count
duration::zero
duration::min
duration::max
duration::operator+
duration::operator-
duration::operator++
duration::operator--
duration::operator+=
duration::operator-=
duration::operator*=
duration::operator/=
duration::operator%=
Non-Member-Funktionen
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.
common_type
operator+
operator-
operator*
operator/
operator%
operator==
operator!=
operator<
operator<=
operator>
operator>=
duration_cast
Helper-Klassen
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.
treat_as_floating_point
duration_values
 
constexpr rep count() const;
Gibt die Anzahl der Ticks für diese Dauer .
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.

Inhaltsverzeichnis

[Bearbeiten] Parameter

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

[Bearbeiten] Rückgabewert

Die Anzahl der Ticks für diese Dauer .
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.

[Bearbeiten] Beispiel

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

Output:

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

[Bearbeiten] Siehe auch

wandelt ein Zeitintervall in ein anderes Zeitintervall mit einer anderen Zeitschrittweite um.
(Funktions-Template) [edit]