duration_cast Function

 

Casts a duration object to a specified type.

template<class To, class Rep, class Period>
    constexpr To duration_cast(const duration<Rep, Period>& Dur);

A duration object of type To that represents the time interval Dur, which is truncated if it has to fit into the target type.

If To is an instantiation of duration, this function does not participate in overload resolution.

Requirements

Header: chrono

Namespace: std::chrono

Show: