首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::chrono::system_clock

Defined in header <chrono>

class system_clock;

(since C++11)

std::chrono::system_clock表示系统范围内的实时挂钟。

它可能不是单调的:在大多数系统中,系统时间可以随时调整。它是唯一一个C++时钟,它能够将它的时间点映射到C样式的时间,因此,将被显示。

std::chrono::system_clock满足…的要求TrivialClock...

成员类型

Member type

Definition

rep

signed arithmetic type representing the number of ticks in the clock's duration 带符号的算术类型,表示时钟持续时间中的滴答数

period

a std::ratio type representing the tick period of the clock, in seconds 一个std::ratio类型,表示时钟的滴答周期,以秒为单位

duration

std::chrono::duration<rep, period>, capable of representing negative durations Std::chrono::duration<滴答数, 滴答周期>,能够表示负的持续时间

time_point

std::chrono::time_point<std::chrono::system_clock>

成员常数

constexpr bool is_steady static

true if the time between ticks is always constant, i.e. calls to now() return values that increase monotonically even in case of some external clock adjustment (public static member constant)

成员函数

now static

returns a std::chrono::time_point representing the current point in time (public static member function)

to_time_t static

converts a system clock time point to std::time_t (public static member function)

from_time_t static

converts std::time_t to a system clock time point (public static member function)

另见

steady_clock (C++11)

monotonic clock that will never be adjusted (class)

high_resolution_clock (C++11)

the clock with the shortest tick period available (class)

代码语言:txt
复制
 © cppreference.com

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

扫码关注腾讯云开发者

领取腾讯云代金券