std::chrono::system_clock - cppreference.com

From cppreference.com

classsystem_clock;(since C++11)Class std::chrono::system_clock represents the system-wide real time wall clock.

It may not be monotonic: on most systems, the system time can be adjusted at any moment. It is the only C++ clock that has the ability to map its time points to C-style time.

std::chrono::system_clock meets the requirements of

TrivialClock

.

The epoch of system_clock is unspecified, but most implementations use Unix Time (i.e., time since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds).

(until C++20)system_clock measures Unix Time (i.e., time since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds).

(since C++20)Time point family

Defined in namespace std::chrono

template<classDuration>usingsys_time=std::chrono::time_point<std::chrono::system_clock,Duration>;(since C++20)usingsys_seconds=sys_time<std::chrono::seconds>;(since C++20)usingsys_days=sys_time<std::chrono::days>;(since C++20)Member types

Member type Definition repsigned arithmetic type representing the number of ticks in the clock's duration perioda

std::ratio

type representing the tick period of the clock, in seconds durationstd::chrono::duration<rep,period>, capable of representing negative durations time_pointstd::chrono::time_point<std::chrono::system_clock>Member constants

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, otherwise false
(public static member constant)Member functions

Notes

The system_clock's time value can be internally adjusted at any time by the operating system, for example due to NTP synchronization or the user changing the system's clock. Daylight Saving Time and time zone changes, however, do not affect it since it is based on the

UTC

time-zone.

See also