在线文档教程
C++
应用 | Utilities

std::chrono::round(std::chrono::time_point)

Std::Time::整数%28 std::time::time[医]点%29

Defined in header
template <class ToDuration, class Clock, class Duration> constexpr time_point<Clock, ToDuration> round(const time_point<Clock, Duration>& tp(since C++17)

返回最近的时间点tp可在ToDuration甚至在半途而废的情况下。

该函数不参与重载解析,除非ToDuration是std::chrono::duration和std::chrono::treat_as_floating_point<typename ToDuration::rep>::value是false...

参数

tp-time point to round to nearest

返回值

d使用类型的持续时间舍入到最近的时间点ToDuration甚至在半途而废的情况下。

可能的实施

模板<class T>结构是[医]持续时间:STD::false[医]类型{};模板<类Rep,类周期>结构是[医]持续时间<std::time::time<rep,time>>:std::true[医]类型{};模板<class到,类时钟,类FromDuration,class=std::Enable[医]如果[医]T<IS[医]持续时间<To>{}&%21 std::rono::[医]如[医]浮[医]点<typename To::rep>{}>>std::time::time[医]点<Clock,to>24%28 Const STD::Time::Time[医]点<时钟,倒转>&tp%29{返回std::chrono::time[医]点<时钟,to>{std::rono::圆形<To>%28 tp.time[医]自[医]EIRCH%28%29%29};}

*。

另见

time_point_castconverts a time point to another time point on the same clock, with a different duration (function template)
ceil(std::chrono::time_point) (C++17)converts a time_point to another, rounding up (function template)
floor(std::chrono::time_point) (C++17)converts a time_point to another, rounding down (function template)
round(std::chrono::duration) (C++17)converts a duration to another, rounding to nearest, ties to even (function template)
roundlroundllround (C++11)(C++11)(C++11)nearest integer, rounding away from zero in halfway cases (function)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/crono/time[医]点/圆