Search⌘ K

Time Duration

Explore how to work with time durations using std::chrono::duration in C++. Understand the role of tick types and periods, and learn to represent different time units ranging from microseconds to hours, enabling accurate time calculations in concurrent programming.

We'll cover the following...

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.

C++
template<
class Rep,
class Period = std::ratio<1>
> class duration;

The tick length is std::ratio<1> by default; ...