From 91b29a296cc23357824358f4cf9174bfc8b2cb0b Mon Sep 17 00:00:00 2001 From: Dirk Vanden Boer Date: Wed, 28 Aug 2024 21:40:19 +0200 Subject: [PATCH] Fix unised variable --- include/infra/chrono.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/infra/chrono.h b/include/infra/chrono.h index ab9a40f1..296e8d8b 100644 --- a/include/infra/chrono.h +++ b/include/infra/chrono.h @@ -140,11 +140,14 @@ template std::string to_string(std::string_view format, std::chrono::time_point tp) { if constexpr (std::is_same_v) { - std::time_t time = std::chrono::system_clock::to_time_t(utc_clock::to_sys(tp)); return fmt::format(fmt::runtime(fmt::format("{{:{}}}", format)), tp); } else { - std::time_t time = Clock::to_time_t(tp); - return fmt::format(fmt::runtime(fmt::format("{{:{}}}", format)), fmt::localtime(time)); + if constexpr (std::is_same_v) { + return fmt::format(fmt::runtime(fmt::format("{{:{}}}", format)), tp); + } else { + std::time_t time = Clock::to_time_t(tp); + return fmt::format(fmt::runtime(fmt::format("{{:{}}}", format)), fmt::localtime(time)); + } } }