Convenience function for locating a time zone in the time zone database. Equivalent to std::chrono::get_tzdb().locate_zone(tz_name).
[edit] Parameters tz_name - a time zone name to locate [edit] Exceptionsstd::runtime_error if the specified time zone cannot be found, or if this is the first reference to the time zone database and the time zone database cannot be initialized.
[edit] NotesA call to this function that is the first reference to the time zone database will cause it to be initialized.
[edit] Example#include <chrono> #include <iostream> int main() { try { for (const auto zone : {"Atlantic/Bermuda", "Alcatraz"}) std::cout << std::chrono::locate_zone(zone)->name() << '\n'; } catch(const std::runtime_error& ex) { std::cout << ex.what() << '\n'; } }
Possible output:
Atlantic/Bermuda std::chrono::tzdb: cannot locate zone: Alcatraz[edit] See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4