Skip to content

Commit

Permalink
Fixed C++17 compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkvdb committed Nov 10, 2023
1 parent 114d188 commit a1e7824
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions include/infra/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "infra/log.h"
#endif

#include "infra/exception.h"

namespace inf::chrono {

#ifdef HAVE_CPP20_CHRONO
Expand Down Expand Up @@ -115,7 +117,11 @@ std::string to_utc_string(std::string_view format, std::chrono::time_point<Clock

inline std::string to_string(std::string_view format, chrono::local_time_point tp)
{
#ifdef HAVE_CPP20_CHRONO
return fmt::format(fmt::runtime(fmt::format("{{:{}}}", format)), tp);
#else
throw inf::RuntimeError("local_time_point to_string requires C++20 support");
#endif
}

#ifdef HAVE_CPP20_CHRONO
Expand Down

0 comments on commit a1e7824

Please sign in to comment.