Deprecate fmt::localtime

This commit is contained in:
Victor Zverovich
2025-03-23 10:45:52 -07:00
parent 3607e92dc9
commit 443a8ef342
2 changed files with 1 additions and 7 deletions

View File

@ -574,7 +574,7 @@ inline auto localtime(std::time_t time) -> std::tm {
#if FMT_USE_LOCAL_TIME #if FMT_USE_LOCAL_TIME
template <typename Duration, template <typename Duration,
FMT_ENABLE_IF(detail::has_current_zone<Duration>())> FMT_ENABLE_IF(detail::has_current_zone<Duration>())>
inline auto localtime(std::chrono::local_time<Duration> time) -> std::tm { FMT_DEPRECATED inline auto localtime(std::chrono::local_time<Duration> time) -> std::tm {
using namespace std::chrono; using namespace std::chrono;
using namespace fmt_detail; using namespace fmt_detail;
return localtime(detail::to_time_t(current_zone()->to_sys<Duration>(time))); return localtime(detail::to_time_t(current_zone()->to_sys<Duration>(time)));

View File

@ -352,12 +352,6 @@ TEST(chrono_test, system_clock_time_point) {
#if FMT_USE_LOCAL_TIME #if FMT_USE_LOCAL_TIME
TEST(chrono_test, localtime) {
auto t = std::time(nullptr);
auto tm = *std::localtime(&t);
EXPECT_TRUE(equal(tm, fmt::localtime(t)));
}
template <typename Duration> template <typename Duration>
auto strftime_full_local(std::chrono::local_time<Duration> tp) -> std::string { auto strftime_full_local(std::chrono::local_time<Duration> tp) -> std::string {
auto t = std::chrono::system_clock::to_time_t( auto t = std::chrono::system_clock::to_time_t(