std::chrono::current_zone 定义于头文件<chrono> conststd::chrono::time_zone*current_zone(); (C++20 起) 从时区数据库获得本地时区的便利函数。等价于std::chrono::get_tzdb().current_zone()。 异常 若这次调用是对时区数据库的首次引用且无法初始化时区数据库,则抛出std::runtime_error。
按照https://learn.microsoft.com/en-us/cpp/standard-library/time-zone-class?view=msvc-170 看起来...
现在,异常将永远不会被抛出,并且您将始终从今天的第一个时刻开始计数秒,即使也有昨天的时间也被计数。
std::chrono::tzdb Member functions tzdb::locate_zone tzdb::current_zone conststd::chrono::time_zone*current_zone()const; (since C++20) Obtains a pointer to astd::chrono::time_zonein this database that represents the local time zone of the computer. ...
std::chrono::current_zone std::chrono::get_tzdb_list std::chrono::get_tzdb std::chrono::locate_zone std::chrono::reload_tzdb std::chrono::remote_version std::chrono::tzdb::locate_zone (C++20 起) 另外,以下标准异常类型派生自std::runtime_error: ...
等价于 std::chrono::get_tzdb().locate_zone(tz_name)。 异常若找不到指定的时区,或若这次调用是对时区数据库的首次引用且无法初始化时区数据库,则抛出 std::runtime_error。 注解若对此函数的调用是对时区数据库的首次引用,则它将导致初始化时区数据库。
namespaceMyTime {usingclock_t= std::chrono::system_clock;usingduration_t=clock_t::duration;usingtime_point_t= std::chrono::zoned_time<duration_t>;time_point_tnow(){returnstd::chrono::zoned_time{std::chrono::current_zone(),clock_t::now()}; }std::stringto_string(time_point_ttp){...
“error C1116: unrecoverable error importing module ‘std’. Specialization of ‘std::chrono::_Make_unique_tzdb_info’ with arguments '__std_tzdb_current_zone_info *__std_tzdb_get_current_zone(void) noexcept, '” This occurs with Microsoft Visual Studio Community 2022 (64-bit) - ...
std::chrono::time_zone Member functions time_zone::name time_zone::get_info time_zone::to_sys time_zone::to_local Nonmember functions operator==operator<=> std::string_viewname()constnoexcept; (since C++20) Obtains the name of this time zone. ...
inline zoned_time<std::chrono::seconds> make_zoned() { return zoned_time<std::chrono::seconds>(); } Using VS2017 ver 15.9.3 What could be wrong? Within the past week or two I pushed a couple of commits which attempted to deal with this problem. However I don't have VS to test...