std::chrono...k::from_sys(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ¦‹ NAME πŸ¦‹

Okay bestie, welcome to the std::chrono...k::from_sys(3) page from the C++ Standard Libary manual. The name is literally:

  • std::chrono::utc_clock::from_sys β€” std::chrono::utc_clock::from_sys

✨ Synopsis ✨

Here’s the signature, exactly as it’s written on the page:

template< class Duration >

static std::chrono::utc_time<std::common_type_t<Duration,
       (since C++20)
std::chrono::seconds>>

    from_sys( const std::chrono::sys_time<Duration>& t );

So this static member function converts a sys_time named t to a utc_time named u that represents the same point in time. The equality that matters is:

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. And if t is the exact date of a leap second insertion, that leap second is counted as inserted. Not me knowing leap-second lore, the page said it 😭

πŸŽ€ Return value πŸŽ€

A utc_time representing the same point in time as t.

πŸ’… See also πŸ’…

  • to_sys β€” converts utc_time to sys_time; [static] (public static member function)
  • clock_cast β€” convert time points of one clock to another; (C++20) (function template)

Source/version/date sign-off: http://cppreference.com, 2024.06.10, and the manual page is std::chrono...k::from_sys(3). Mwah πŸ’–βœ¨

πŸ“¦ where this page comes from