From e01a7d756fd8e42fad74abedd1e9de8819ed773c Mon Sep 17 00:00:00 2001 From: Aaron Konishi Date: Mon, 29 Jan 2024 17:07:59 +0800 Subject: [PATCH] Update daily_file_sink.h solve compiler problem: not supported std::put_time() under version 5 --- include/spdlog/sinks/daily_file_sink.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 1b1dc44a..7ad92196 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -53,7 +53,13 @@ struct daily_filename_format_calculator { #else std::stringstream stream; #endif +#if __GNUC__ >= 5 stream << std::put_time(&now_tm, file_path.c_str()); +#else + char time_buf[64]; + std::strftime(time_buf, sizeof(time_buf), file_path.c_str(), &now_tm); + stream << time_buf; +#endif return stream.str(); } };