std::chrono::time_point_cast

From cppreference.com
template <class ToDuration, class Clock, class Duration>
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration> &t);
(since C++11)

Converts a std::chrono::time_point from one duration to another.

Contents

[edit] Parameters

t - time_point to convert from

[edit] Return value

std::chrono::time_point<Clock, ToDuration>(std::chrono::duration_cast<ToDuration>(t.time_since_epoch()))

[edit] Notes

time_point_cast will only participate in overload resolution if ToDuration is an instantiation of duration.

[edit] Example