mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
add check for gcc version less than 5 due to missing std::put_time
This commit is contained in:
parent
b71221ac31
commit
015e5dab03
4
.gitignore
vendored
4
.gitignore
vendored
@ -49,3 +49,7 @@ test/build/
|
|||||||
|
|
||||||
Dockerfile
|
Dockerfile
|
||||||
|
|
||||||
|
# VS
|
||||||
|
.vs/
|
||||||
|
out/
|
||||||
|
CMakeSettings.json
|
||||||
|
@ -95,6 +95,10 @@ if(OATPP_DISABLE_LOGE)
|
|||||||
add_definitions(-DOATPP_DISABLE_LOGE)
|
add_definitions(-DOATPP_DISABLE_LOGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 5.0)
|
||||||
|
add_definitions(-DOATPP_DISABLE_STD_PUT_TIME)
|
||||||
|
endif()
|
||||||
|
|
||||||
message("\n############################################################################\n")
|
message("\n############################################################################\n")
|
||||||
|
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
@ -90,10 +90,16 @@ void DefaultLogger::log(v_int32 priority, const std::string& tag, const std::str
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(m_config.timeFormat) {
|
if(m_config.timeFormat) {
|
||||||
time_t seconds = std::chrono::duration_cast<std::chrono::seconds>(time).count();
|
time_t seconds = std::chrono::duration_cast<std::chrono::seconds>(time).count();
|
||||||
struct tm now;
|
struct tm now;
|
||||||
localtime_r(&seconds, &now);
|
localtime_r(&seconds, &now);
|
||||||
std::cout << std::put_time(&now, m_config.timeFormat);
|
#ifdef OATPP_DISABLE_STD_PUT_TIME
|
||||||
|
char timeBuffer[50];
|
||||||
|
strftime(timeBuffer, sizeof(timeBuffer), m_config.timeFormat, &now);
|
||||||
|
std::cout << timeBuffer;
|
||||||
|
#else
|
||||||
|
std::cout << std::put_time(&now, m_config.timeFormat);
|
||||||
|
#endif
|
||||||
indent = true;
|
indent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user