std::chrono...ote_version,(3)
π NAME π
ok so this page is about std::chrono::get_tzdb_list, std::chrono::get_tzdb, and std::chrono::remote_version β bestie, these are your time zone database access girlies β¨ (yes, cppreference threw reload_tzdb in the synopsis too, we'll get to her π
)
oh and for the record, this is a page from the C++ Standard Libary manual (that's their spelling, not mine, love them tho π«Ά).
πΈ Synopsis πΈ
std::chrono::tzdb_list& get_tzdb_list(); (1) (since C++20)
const std::chrono::tzdb& get_tzdb(); (2) (since C++20)
std::string remote_version(); (3) (since C++20)
const std::chrono::tzdb& reload_tzdb(); (4) (since C++20)
These functions literally give you access to the program-wide time zone database. main character energy, no cap π
- Returns a reference to the global
std::chrono::tzdb_listsingleton. If this is the first access to the database, it initializes the database. After the initialization, the database will hold a single initializedstd::chrono::tzdbobject. This function is thread-safe: concurrent calls to this function from multiple threads do not introduce a data race. slay π§ - Returns a reference to the first
std::chrono::tzdbobject held by thetzdb_listsingleton. It's equivalent tostd::chrono::get_tzdb_list().front(). iykyk π« - Returns a string containing the latest remote database version. iconic.
- If
remote_version() != get_tzdb().version, it pushes a newtzdbobject representing the remote database to the front of thetzdb_listsingleton referenced byget_tzdb_list(). Otherwise there are no effects β literally nothing happens, we love a low-effort queen π No references, pointers or iterators are invalidated. Calling this function concurrently withget_tzdb_list().front()orget_tzdb_list().erase_after()does not introduce a data race. π©·
π Exceptions π
std::runtime_errorif for any reason a reference to atzdb_listcontaining one or more validtzdbcannot be returned. like... if it can't even, it throws. periodt π
π Return value π
- A reference to the global
std::chrono::tzdb_listsingleton. std::chrono::get_tzdb_list().front().- A string containing the latest remote database version.
std::chrono::get_tzdb_list().front()(after any update made by this function).
ok bestie real talk: item (1) is the only one with a documented exception, and (4) is the only one that can quietly change the database under you β but it still promises not to invalidate references, pointers or iterators, and it plays nice (no data race) withget_tzdb_list().front()andget_tzdb_list().erase_after(). that's the whole tea π
and that's the page!! mwah π this sweet little writeup is straight from http://cppreference.com, dated 2024.06.10 β go give them a follow and hydrate, ily, bye ππβ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms