Time Duration
Time duration std::chrono::duration
is a class template that consists of the type of the tick Rep
and the length of a tick Period
.
The tick length is by default std::ratio<1>
. std::ratio<1>
stands for a second and can also be written as std::ratio<1, 1>
. The rest is quite easy. std::ratio<60>
is a minute and std::ratio<1,1000>
a millisecond. When the type of Rep
is a floating-point number, you can use it to hold fractions of time ticks.
C++11 predefines the most important time durations: