27 Time library [time]

27.7 Clocks [time.clock]

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

27.7.2.2 Member functions [time.clock.utc.members]

static time_point now();
Returns: from_­sys(system_­clock​::​now()), or a more accurate value of utc_­time.
template<class Duration> static sys_time<common_type_t<Duration, seconds>> to_sys(const utc_time<Duration>& u);
Returns: A sys_­time t, such that from_­sys(t) == u if such a mapping exists.
Otherwise u represents a time_­point during a positive leap second insertion, the conversion counts that leap second as not inserted, and the last representable value of sys_­time prior to the insertion of the leap second is returned.
template<class Duration> static utc_time<common_type_t<Duration, seconds>> from_sys(const sys_time<Duration>& t);
Returns: A utc_­time u, such that u.time_­since_­epoch() - t.time_­since_­epoch() is equal to the sum of leap seconds that were inserted between t and 1970-01-01.
If t is exactly the date of leap second insertion, then the conversion counts that leap second as inserted.
Example
:
auto t = sys_days{July/1/2015} - 2ns;
auto u = utc_clock::from_sys(t);
assert(u.time_since_epoch() - t.time_since_epoch() == 25s);
t += 1ns;
u = utc_clock::from_sys(t);
assert(u.time_since_epoch() - t.time_since_epoch() == 25s);
t += 1ns;
u = utc_clock::from_sys(t);
assert(u.time_since_epoch() - t.time_since_epoch() == 26s);
t += 1ns;
u = utc_clock::from_sys(t);
assert(u.time_since_epoch() - t.time_since_epoch() == 26s);
— end example
 ]