Skip to content

Search topics & cppreference

Search all study topics, concept maps, and 6,587 C++ and C reference pages.

std::chrono::utc_clock::from_sys

Converts a sys_time t to a utc_time u that represents the same point in time.

NotebookLM
template< class Duration >
static std::chrono::utc_time<std::common_type_t<Duration, std::chrono::seconds>>
    from_sys( const std::chrono::sys_time<Duration>& t );
(since C++20)

Converts a sys_time t to a utc_time u that represents the same point in time.

u.time_since_epoch() - t.time_since_epoch() is equal to the number of leap seconds that was inserted between t and 1 January 1970. If t is the exact date of a leap second insertion, that leap second is counted as inserted.

Return value

A utc_time representing the same point in time as t.

See also

[static]
converts utc_time to sys_time
(public static member function)
convert time points of one clock to another
(function template)

Content from this page on cppreference.com, licensed under CC-BY-SA 3.0 and GFDL. Modified: restyled, site navigation removed, code windows added. Offline snapshot of 9 February 2025.