|
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defined in header <chrono> | ||
conststd::chrono::time_zone* current_zone(); | (since C++20) | |
Convenience function for obtaining local time zone from thetime zone database. Equivalent tostd::chrono::get_tzdb().current_zone().
Contents |
std::runtime_error if this is the first reference to the time zone database and the time zone database cannot be initialized.
A call to this function that is the first reference to the time zone database will cause it to be initialized.
#include <chrono>#include <iostream> int main(){try{conststd::chrono::zoned_time cur_time{ std::chrono::current_zone(),// may throwstd::chrono::system_clock::now()};std::cout<< cur_time<<'\n';}catch(conststd::runtime_error& ex){std::cerr<< ex.what()<<'\n';}}
Possible output:
2021-09-13 19:46:42.249182012 MAGT
| return the local time zone (public member function of std::chrono::tzdb)[edit] | |
| accesses and controls the global time zone database information (function)[edit] |