chrono

标准库标头<chrono>

此标头是日期和时间图书馆。

在命名空间std::timeo中定义

*。

持续时间%28C++11%29 a时间间隔%28类模板%29

系统[医]时钟%28C++11%29来自系统范围内的实时时钟%28class%29

稳住[医]永远不会调整的时钟%28C++11%29

高[医]分辨力[医]时钟%28C++11%29具有最短的刻度周期的时钟%28C++11%29

时间[医]时间点%28C++11%29 a点%28类模板%29

治疗[医]如[医]浮[医]点表示一个持续时间可以转换为具有不同刻度周期%28类模板%29的持续时间。

持续时间[医]值构造给定类型%28类模板%29的滴答计数的零值、最小值和最大值。

方便型

在命名空间std::timeo中定义

Std::Time::纳秒持续时间类型与周期STD::Nano

Std::Time::微秒持续时间类型与周期std::microte

Std::timeo::毫秒持续时间类型与周期std::Milli

Std::Time::秒持续时间类型与时间段STD::比率<1>

Std::Crono::分钟持续时间类型与期间STD::比率<60>

时间::小时持续时间类型与期间std::比率<3600>

专门性

在命名空间std中定义

性病:普通[医]类型<std::crono::time>专门化std::public[医]类型特征%28类模板专门化%29

性病:普通[医]类型<std::time::time[医]点>专门研究性病::公共[医]类型特征%28类模板专门化%29

功能

持续时间

*。

在命名空间std::timeo中定义

运算符+运算符%2A运算符/运算符%实现算术操作,使用持续时间作为参数%28函数模板%29

运算符==运算符%21=运算符<运算符<=运算符>>=比较两个持续时间%28函数模板%29

持续时间[医]强制转换将一个持续时间转换为另一个持续时间,使用不同的刻度间隔%28功能模板%29。

地板%28 std::time::工期%29%28C++17%29将持续时间转换为另一个持续时间,舍入%28功能模板%29

Ceil%28std::timeo::工期%29%28C++17%29将持续时间转换为另一个持续时间,舍入%28功能模板%29

圆周%28 std::time::工期%29%28C++17%29将持续时间转换为另一个持续时间,舍入到最近,与偶数%28函数模板%29相关联

ABS%28 std::time::工期%29%28C++17%29获得持续时间%28功能模板%29的绝对值

时间点

在命名空间std::timeo中定义

操作符+操作符-用给定的持续时间%28函数模板%29修改时间点

运算符==运算符%21=运算符<运算符<=运算符>>=比较两个时点%28函数模板%29

时间[医]点[医]CAST将时间点转换为同一时钟上的另一个时间点,具有不同的持续时间%28功能模板%29。

地板%28天::时间::时间[医]点%29%28C++17%29转换一次[医]指向另一个,舍入%28函数模板%29

Ceil%28 std::Time::Time[医]点%29%28C++17%29转换一次[医]指向另一个,将%28函数模板%29舍入

第28轮::时间::时间[医]点%29%28C++17%29转换一次[医]指向另一个,四舍五入至最近,与偶数%28函数模板%29相关联

文字

定义在内联命名空间std::文本::chrono中[医]文字

操作符“h%28C++14%29

操作符“min”%28C++14%29

运算符“s%28C++14%29

操作符ms%28C++14%29

操作符“”US%28C++14%29

运算符ns%28C++14%29

简介

二次

namespace std { namespace chrono { // class template duration template <class Rep, class Period = ratio<1>> class duration; // class template time_point template <class Clock, class Duration = typename Clock::duration> class time_point; } // common_type specializations template <class Rep1, class Period1, class Rep2, class Period2> struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>; template <class Clock, class Duration1, class Duration2> struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>; namespace chrono { // customization traits template <class Rep> struct treat_as_floating_point; template <class Rep> struct duration_values; template <class Rep> constexpr bool treat_as_floating_point_v = treat_as_floating_point<Rep>::value; // duration arithmetic template <class Rep1, class Period1, class Rep2, class Period2> common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>> constexpr operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs template <class Rep1, class Period1, class Rep2, class Period2> common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>> constexpr operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs template <class Rep1, class Period, class Rep2> duration<common_type_t<Rep1, Rep2>, Period> constexpr operator*(const duration<Rep1, Period>& d, const Rep2& s template <class Rep1, class Rep2, class Period> duration<common_type_t<Rep1, Rep2>, Period> constexpr operator*(const Rep1& s, const duration<Rep2, Period>& d template <class Rep1, class Period, class Rep2> duration<common_type_t<Rep1, Rep2>, Period> constexpr operator/(const duration<Rep1, Period>& d, const Rep2& s template <class Rep1, class Period1, class Rep2, class Period2> common_type_t<Rep1, Rep2> constexpr operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs template <class Rep1, class Period, class Rep2> duration<common_type_t<Rep1, Rep2>, Period> constexpr operator%(const duration<Rep1, Period>& d, const Rep2& s template <class Rep1, class Period1, class Rep2, class Period2> common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>> constexpr operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs // duration comparisons template <class Rep1, class Period1, class Rep2, class Period2> constexpr bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs template <class Rep1, class Period1, class Rep2, class Period2> constexpr bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs template <class Rep1, class Period1, class Rep2, class Period2> constexpr bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs template <class Rep1, class Period1, class Rep2, class Period2> constexpr bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs template <class Rep1, class Period1, class Rep2, class Period2> constexpr bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs template <class Rep1, class Period1, class Rep2, class Period2> constexpr bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs // duration_cast template <class ToDuration, class Rep, class Period> constexpr ToDuration duration_cast(const duration<Rep, Period>& d template <class ToDuration, class Rep, class Period> constexpr ToDuration floor(const duration<Rep, Period>& d template <class ToDuration, class Rep, class Period> constexpr ToDuration ceil(const duration<Rep, Period>& d template <class ToDuration, class Rep, class Period> constexpr ToDuration round(const duration<Rep, Period>& d // convenience typedefs using nanoseconds = duration</*signed integer type of at least 64 bits*/ , nano>; using microseconds = duration</*signed integer type of at least 55 bits*/ , micro>; using milliseconds = duration</*signed integer type of at least 45 bits*/ , milli>; using seconds = duration</*signed integer type of at least 35 bits*/ >; using minutes = duration</*signed integer type of at least 29 bits*/ , ratio< 60>>; using hours = duration</*signed integer type of at least 23 bits*/ , ratio<3600>>; // time_point arithmetic template <class Clock, class Duration1, class Rep2, class Period2> constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>> operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs template <class Rep1, class Period1, class Clock, class Duration2> constexpr time_point<Clock, common_type_t<duration<Rep1, Period1>, Duration2>> operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs template <class Clock, class Duration1, class Rep2, class Period2> constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>> operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs template <class Clock, class Duration1, class Duration2> constexpr common_type_t<Duration1, Duration2> operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs // time_point comparisons template <class Clock, class Duration1, class Duration2> constexpr bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs template <class Clock, class Duration1, class Duration2> constexpr bool operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs template <class Clock, class Duration1, class Duration2> constexpr bool operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs template <class Clock, class Duration1, class Duration2> constexpr bool operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs template <class Clock, class Duration1, class Duration2> constexpr bool operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs template <class Clock, class Duration1, class Duration2> constexpr bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs // time_point_cast template <class ToDuration, class Clock, class Duration> constexpr time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t template <class ToDuration, class Clock, class Duration> constexpr time_point<Clock, ToDuration> floor(const time_point<Clock, Duration>& tp template <class ToDuration, class Clock, class Duration> constexpr time_point<Clock, ToDuration> ceil(const time_point<Clock, Duration>& tp template <class ToDuration, class Clock, class Duration> constexpr time_point<Clock, ToDuration> round(const time_point<Clock, Duration>& tp // specialized algorithms template <class Rep, class Period> constexpr duration<Rep, Period> abs(duration<Rep, Period> d // clocks class system_clock; class steady_clock; class high_resolution_clock; } inline namespace literals { inline namespace chrono_literals { // suffixes for duration literals constexpr chrono::hours operator "" h(unsigned long long constexpr chrono::duration</*unspecified*/, ratio<3600,1>> operator "" h(long double constexpr chrono::minutes operator "" min(unsigned long long constexpr chrono::duration</*unspecified*/, ratio<60,1>> operator "" min(long double constexpr chrono::seconds operator "" s(unsigned long long constexpr chrono::duration</*unspecified*/ > operator "" s(long double constexpr chrono::milliseconds operator "" ms(unsigned long long constexpr chrono::duration</*unspecified*/, milli> operator "" ms(long double constexpr chrono::microseconds operator "" us(unsigned long long constexpr chrono::duration</*unspecified*/, micro> operator "" us(long double constexpr chrono::nanoseconds operator "" ns(unsigned long long constexpr chrono::duration</*unspecified*/, nano> operator "" ns(long double } } namespace chrono { using namespace literals::chrono_literals; }

二次

std::chrono::treat_as_floating_point

二次

template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> { };

二次

std::chrono::duration_values

二次

template <class Rep> struct duration_values { public: static constexpr Rep zero( static constexpr Rep min( static constexpr Rep max( };

二次

std::chrono::duration

二次

template <class Rep, class Period = ratio<1>> class duration { public: using rep = Rep; using period = Period; private: rep rep_; // exposition only public: // construct/copy/destroy constexpr duration() = default; template <class Rep2> constexpr explicit duration(const Rep2& r template <class Rep2, class Period2> constexpr duration(const duration<Rep2, Period2>& d ~duration() = default; duration(const duration&) = default; duration& operator=(const duration&) = default; // observer constexpr rep count() const; // arithmetic constexpr duration operator+() const; constexpr duration operator-() const; constexpr duration& operator++( constexpr duration operator++(int constexpr duration& operator--( constexpr duration operator--(int constexpr duration& operator+=(const duration& d constexpr duration& operator-=(const duration& d constexpr duration& operator*=(const rep& rhs constexpr duration& operator/=(const rep& rhs constexpr duration& operator%=(const rep& rhs constexpr duration& operator%=(const duration& rhs // special values static constexpr duration zero( static constexpr duration min( static constexpr duration max( };

二次

std::chrono::time_point

二次

template <class Clock, class Duration = typename Clock::duration> class time_point { public: using clock = Clock; using duration = Duration; using rep = typename duration::rep; using period = typename duration::period; private: duration d_; // exposition only public: // construct constexpr time_point( // has value epoch constexpr explicit time_point(const duration& d // same as time_point() + d template <class Duration2> constexpr time_point(const time_point<clock, Duration2>& t // observer constexpr duration time_since_epoch() const; // arithmetic constexpr time_point& operator+=(const duration& d constexpr time_point& operator-=(const duration& d // special values static constexpr time_point min( static constexpr time_point max( };

二次

std::chrono::system_clock

二次

class system_clock { public: using rep = /*see description*/ ; using period = ratio</*unspecified*/, /*unspecified*/ >; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point<system_clock>; static constexpr bool is_steady = /*unspecified*/ ; static time_point now() noexcept; // Map to C API static time_t to_time_t (const time_point& t) noexcept; static time_point from_time_t(time_t t) noexcept; };

二次

std::chrono::steady_clock

二次

class steady_clock { public: using rep = /*unspecified*/ ; using period = ratio</*unspecified*/, /*unspecified*/ >; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point</*unspecified*/, duration>; static constexpr bool is_steady = true; static time_point now() noexcept; };

二次

std::chrono::high_resolution_clock

二次

class high_resolution_clock { public: using rep = /*unspecified*/ ; using period = ratio</*unspecified*/, /*unspecified*/ >; using duration = chrono::duration<rep, period>; using time_point = chrono::time_point</*unspecified*/, duration>; static constexpr bool is_steady = /*unspecified*/ ; static time_point now() noexcept; };

二次

© cppreference.com

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

http://en.cppreference.com/w/cpp/报头/rono