Share via


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);

Return Value

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

Remarks

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

Requirements

Header: chrono

Namespace: std::chrono

See Also

Reference

<chrono>

duration Class

Other Resources

Header Files