|
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Non-member functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Helper classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
constexpr rep count()const; | (since C++11) | |
Returns the number of ticks for this duration.
Contents |
(none)
The number of ticks for this duration.
#include <chrono>#include <iostream> int main(){std::chrono::milliseconds ms{3};// 3 milliseconds// 6000 microseconds constructed from 3 millisecondsstd::chrono::microseconds us=2* ms;// 30Hz clock using fractional ticksstd::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 ticks6000 us duration has 6000 ticks3.5 30Hz duration has 3.5 ticks
(C++11) | converts a duration to another, with a different tick interval (function template)[edit] |