Documentation Home

Construct a std::chrono::duration instance with a specified count.

template <class Rep2>
constexpr explicit duration(const Rep2& r);

Effects:

The internal value of the duration object is initialized with static_cast<rep>(r).

Requirements:

This constructor only participates in overload resolution if Rep2 is implicitly convertible to Rep and either Rep is a floating point type or Rep2 is not a floating point type.

Postcondition:

this->count()==static_cast<rep>(r)

Header

#include <chrono>

See Also