diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index ff3e1445..e5c734db 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -477,11 +477,14 @@ inline std::tm localtime(std::time_t time) { return lt.tm_; } +inline std::tm localtime(std::chrono::system_clock::time_point time_point) { + return localtime(std::chrono::system_clock::to_time_t(time_point)); +} + #if FMT_USE_LOCAL_TIME template inline auto localtime(std::chrono::local_time time) -> std::tm { - return localtime(std::chrono::system_clock::to_time_t( - std::chrono::current_zone()->to_sys(time))); + return localtime(std::chrono::current_zone()->to_sys(time)); } #endif