std::chrono::time_zone(3)

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

πŸŽ€ std::chrono::time_zone πŸŽ€

okay bestie, welcome to the std::chrono::time_zone(3) page from the C++ Standard Libary manual. This is the C++ time zone class and it's honestly a little iconic. πŸ’–

πŸ’« NAME πŸ’«

std::chrono::time_zone β€” std::chrono::time_zone. That's the name, no cap. 🫢

✨ Synopsis ✨

Defined in header <chrono>:

class time_zone;            (since C++20)

So time_zone is the class for all time zone transitions in one specific geographic area. Yes, all the transitions. It's giving geographic time zone main character energy. πŸŒπŸ’…

Users cannot construct time_zone objects. Nope, not you, not your friend, not even your very smartest template. The library implementation is the one creating time_zone objects β€” it does that when it initializes the time zone database β€” and it provides const access to these objects. So the library does the crafting, and you get to look respectfully. πŸ‘€βœ¨

time_zone is not copyable but does have a defaulted move constructor and a defaulted move assignment operator. Cute! But here's the plot twist: as users have only const access to time_zone objects, these functions cannot be called in user code without invoking undefined behavior.

⚠️ Undefined behavior alert: those move functions exist, but user code cannot call them without invoking undefined behavior. So do not test the universe on this one, bestie. Periodt. 🚫😭

🌸 Member functions 🌸

  • name β€” obtains the name of this time_zone (public member function). 🏷️
  • get_info β€” obtains information associated with a sys_time or local_time (public member function). πŸ”Ž
  • to_sys β€” converts a local_time in this time zone to a sys_time (public member function). ⏰➑️🌐
  • to_local β€” converts a sys_time to a local_time in this time zone (public member function). 🌐➑️⏰

πŸ¦‹ Nonmember functions πŸ¦‹

  • operator== β€” compares two time_zone objects. 🫢
  • operator<=> β€” (function), (C++20). ✨

That's the whole page, bestie! Source: http://cppreference.com. Version/date: 2024.06.10. Page: std::chrono::time_zone(3). Now go forth and let the library handle the time zone database, because that's its job and it ate. πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from