std::chrono...ck::from_utc(3)

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

πŸ’… std::chrono::file_clock::to_utc / std::chrono::file_clock::from_utc πŸ’…

okay so bestie, this page is from the C++ Standard Libary manual, and the main characters are std::chrono::file_clock::to_utc and std::chrono::file_clock::from_utc β€” iconic clock-conversion duo, no cap πŸ•°οΈβœ¨


✨ Synopsis ✨

two function templates, both since C++20, both optional β€” here's the exact shape:

          template< class Duration >
                                                                        (since
       C++20)
          static std::chrono::utc_time</* see below */>             (1)
       (optional)

              to_utc( const std::chrono::file_time<Duration>& t );
          template< class Duration >
                                                                        (since
       C++20)
          static std::chrono::file_time</* see below */>            (2)
       (optional)

              from_utc( const std::chrono::utc_time<Duration>& t );
  1. Converts the file_time t to a utc_time representing the same point in time.
  2. Converts the utc_time t to a file_time representing the same point in time.

The duration of the return type is computed from Duration in an unspecified manner.

These function templates are optional: an implementation may choose to instead provide to_sys and from_sys. like, they can lowkey swap them out on you, so don't act surprised πŸ‘€


🫢 Return value 🫢

  1. A utc_time representing the same point in time as the argument.
  2. A file_time representing the same point in time as the argument.

same moment, different clock outfit β€” slay πŸ’«


🌸 Notes 🌸

bestie, real talk: user code should usually use std::chrono::clock_cast, which provides a generic interface to convert time points between clocks, rather than call these functions directly. it's giving "use the main character API, not the side quest" energy 🧚

πŸ¦‹ Example πŸ¦‹

This section is incomplete.

Reason: no example.

not me showing up with an empty example section 😭 it's literally just vibes and a todo πŸŽ€


πŸ‘‘ See also πŸ‘‘

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

πŸ’€ Category πŸ’€

  • Todo no example

with all the love and zero cap, this page came from source/version http://cppreference.com, dated 2024.06.10, page std::chrono...ck::from_utc(3) πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from