From d885b73e1fd87163e62bea44aa8884507ec36837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E7=AB=A0=E6=B0=B8?= Date: Mon, 13 Mar 2023 15:33:36 +0800 Subject: [PATCH 1/2] Update compiler_config.hpp --- include/boost/date_time/compiler_config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/date_time/compiler_config.hpp b/include/boost/date_time/compiler_config.hpp index 14f9254c..317797cb 100644 --- a/include/boost/date_time/compiler_config.hpp +++ b/include/boost/date_time/compiler_config.hpp @@ -121,7 +121,7 @@ namespace std { #if defined(BOOST_HAS_THREADS) -# if defined(_MSC_VER) || defined(__MWERKS__) || defined(__MINGW32__) || defined(__BORLANDC__) +# if defined(__MWERKS__) || defined(__MINGW32__) || defined(__BORLANDC__) //no reentrant posix functions (eg: localtime_r) # elif (!defined(__hpux) || (defined(__hpux) && defined(_REENTRANT))) # define BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS From edd93d0705e990ae5cabeeb2bc5b9d2cb542d699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E7=AB=A0=E6=B0=B8?= Date: Mon, 13 Mar 2023 15:48:44 +0800 Subject: [PATCH 2/2] Update c_time.hpp --- include/boost/date_time/c_time.hpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/include/boost/date_time/c_time.hpp b/include/boost/date_time/c_time.hpp index 24286f8a..db8800b1 100644 --- a/include/boost/date_time/c_time.hpp +++ b/include/boost/date_time/c_time.hpp @@ -63,6 +63,12 @@ namespace date_time { result = 0; else *result = tmp; +#elif defined(_MSC_VER) + std::tm tmp; + if(localtime_s(&tmp, t)) + result = 0; + else + *result = tmp; #else result = localtime_r(t, result); #endif @@ -81,6 +87,12 @@ namespace date_time { result = 0; else *result = tmp; +#elif defined(_MSC_VER) + std::tm tmp; + if(gmtime_s(&tmp, t)) + result = 0; + else + *result = tmp; #else result = gmtime_r(t, result); #endif @@ -93,9 +105,6 @@ namespace date_time { #if defined(__clang__) // Clang has to be checked before MSVC #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" -#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) -#pragma warning(push) // preserve warning settings -#pragma warning(disable : 4996) // disable depricated localtime/gmtime warning on vc8 #endif //! requires a pointer to a user created std::tm struct inline @@ -117,8 +126,6 @@ namespace date_time { } #if defined(__clang__) // Clang has to be checked before MSVC #pragma clang diagnostic pop -#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) -#pragma warning(pop) // restore warnings to previous state #endif #endif // BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS