27 Time library [time]

27.7 Clocks [time.clock]

27.7.1 Class system_Β­clock [time.clock.system]

27.7.1.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;

    // mapping to/from C type time_Β­t
    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 between sys_Β­time and calendar types ([time.cal]).
Example
:
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
 ]