27 Time library [time]

27.7 Clocks [time.clock]

27.7.2 Class utc_­clock [time.clock.utc]

27.7.2.1 Overview [time.clock.utc.overview]

namespace std::chrono {
  class utc_clock {
  public:
    using rep                       = a signed arithmetic type;
    using period                    = ratio<unspecified, unspecified>;
    using duration                  = chrono::duration<rep, period>;
    using time_point                = chrono::time_point<utc_clock>;
    static constexpr bool is_steady = unspecified;

    static time_point now();

    template<class Duration>
      static sys_time<common_type_t<Duration, seconds>>
        to_sys(const utc_time<Duration>& t);
    template<class Duration>
      static utc_time<common_type_t<Duration, seconds>>
        from_sys(const sys_time<Duration>& t);
  };
}
In contrast to sys_­time, which does not take leap seconds into account, utc_­clock and its associated time_­point, utc_­time, count time, including leap seconds, since 1970-01-01 00:00:00 UTC.
[Note
: The UTC time standard began on 1972-01-01 00:00:10 TAI. To measure time since this epoch instead, one can add/subtract the constant sys_­days{1972y/1/1} - sys_­days{1970y/1/1} (63'072'000s) from the utc_­time. — end note
]
[Example
:
clock_­cast<utc_­clock>(sys_­seconds{sys_­days{1970y/January/1}}).time_­since_­epoch() is 0s.
clock_­cast<utc_­clock>(sys_­seconds{sys_­days{2000y/January/1}}).time_­since_­epoch()
is 946'684'822s, which is 10'957 * 86'400s + 22s.
— end example
]
utc_­clock is not a Cpp17TrivialClock unless the implementation can guarantee that utc_­clock​::​now() does not propagate an exception.
[Note
:
noexcept(from_­sys(system_­clock​::​now())) is false.
— end note
]