std::chrono::duration<Rep,Period>::count (3) - Linux Manuals
std::chrono::duration<Rep,Period>::count: std::chrono::duration<Rep,Period>::count
Command to display std::chrono::duration<Rep,Period>::count
manual in Linux: $ man 3 std::chrono::duration<Rep,Period>::count
NAME
std::chrono::duration<Rep,Period>::count - std::chrono::duration<Rep,Period>::count
Synopsis
constexpr rep count() const;
Returns the number of ticks for this duration.
Parameters
(none)
Return value
The number of ticks for this duration.
Example
// Run this code
#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
See also
converts a duration to another, with a different tick interval
duration_cast (function template)
Pages related to std::chrono::duration<Rep,Period>::count
- std::chrono::duration<Rep,Period>::duration (3) - std::chrono::duration<Rep,Period>::duration
- std::chrono::duration<Rep,Period>::max (3) - std::chrono::duration<Rep,Period>::max
- std::chrono::duration<Rep,Period>::min (3) - std::chrono::duration<Rep,Period>::min
- std::chrono::duration<Rep,Period>::operator+(unary), (3) - std::chrono::duration<Rep,Period>::operator+(unary),
- std::chrono::duration<Rep,Period>::operator+(unary),std::chrono::duration<Rep,Period>::operator-(unary) (3) - std::chrono::duration<Rep,Period>::operator+(unary),std::chrono::duration<Rep,Period>::operator-(unary)
- std::chrono::duration<Rep,Period>::operator++, (3) - std::chrono::duration<Rep,Period>::operator++,
- std::chrono::duration<Rep,Period>::operator++,std::chrono::duration<Rep,Period>::operator-- (3) - - std::chrono::duration<Rep,Period>::operator++,std::chrono::duration<Rep,Period>::operator--
- std::chrono::duration<Rep,Period>::operator= (3) - std::chrono::duration<Rep,Period>::operator=
- std::chrono::duration<Rep,Period>::zero (3) - std::chrono::duration<Rep,Period>::zero
- std::chrono::duration (3) - std::chrono::duration
- std::chrono::duration_cast (3) - std::chrono::duration_cast
- std::chrono::duration_values (3) - std::chrono::duration_values
- std::chrono::duration_values<Rep>::max (3) - std::chrono::duration_values<Rep>::max
- std::chrono::duration_values<Rep>::min (3) - std::chrono::duration_values<Rep>::min
- std::chrono::duration_values<Rep>::zero (3) - std::chrono::duration_values<Rep>::zero
- std::chrono::day (3) - std::chrono::day
- std::chrono::day::day (3) - std::chrono::day::day
- std::chrono::day::ok (3) - std::chrono::day::ok