[time.clock.system.overview] (original) (raw)

30 Time library [time]

30.7 Clocks [time.clock]

30.7.2 Class system_clock [time.clock.system]

30.7.2.1 Overview [time.clock.system.overview]

namespace std::chrono { class system_clock { public: using rep = see below;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;static time_t to_time_t (const time_point& t) noexcept;static time_point from_time_t(time_t t) noexcept;};}

Objects of type system_clock represent wall clock time from the system-wide realtime clock.

Objects of type sys_time<Duration> measure time since 1970-01-01 00:00:00 UTC excluding leap seconds.

This measure is commonly referred to as Unix time.

This measure facilitates an efficient mapping betweensys_time and calendar types ([time.cal]).

[Example 1:

sys_seconds{sys_days{1970y/January/1}}.time_since_epoch() is 0s.

sys_seconds{sys_days{2000y/January/1}}.time_since_epoch() is 946'684'800s, which is 10'957 * 86'400s.

— _end example_]