Skip to content

Commit

Permalink
Fix unised variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkvdb committed Aug 28, 2024
1 parent c64dff0 commit 91b29a2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions include/infra/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,14 @@ template <typename Clock, typename Duration>
std::string to_string(std::string_view format, std::chrono::time_point<Clock, Duration> tp)
{
if constexpr (std::is_same_v<Clock, utc_clock>) {
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<Clock, utc_clock>) {
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));
}
}
}

Expand Down

0 comments on commit 91b29a2

Please sign in to comment.