I'm trying to get a std::string of ISO time using {fmt}.
Consider the following code:
const auto t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
const auto creation_time = fmt::format("{:%FT%T%z}", fmt::localtime(t));
I'm getting the following error:
../deps/fmt-src/include/fmt/chrono.h: In function 'size_t fmt::v7::detail::strftime(char*, size_t, const char*, const tm*)': ../deps/fmt-src/include/fmt/chrono.h:377:48: error: format not a string literal, format string not checked [-Werror=format-nonliteral] return std::strftime(str, count, format, time);
Which I don't get, as clearly fmt::localtime(t) is not a compile-time string.
What am I missing?
Using {fmt} v7.1.3, compiled using the following flags to work on embedded system:
target_compile_definitions(fmt PRIVATE FMT_STATIC_THOUSANDS_SEPARATOR FMT_USE_DOUBLE=0 FMT_USE_LONG_DOUBLE=0)