gmtime() and localtime() are reentrant when using MS C runtime library (MinGW/MSVC).
This commit is contained in:
parent
5a303de801
commit
1b38cbeb3f
@ -7,6 +7,9 @@ VERSION 0.8.1cvs
|
||||
* SMTPTransport.cpp: fixed bug in disconnect() when authentication is
|
||||
not needed (thanks to Benjamin Biron).
|
||||
|
||||
* dateTime.cpp: gmtime() and localtime() are reentrant when using
|
||||
MS C runtime library (MinGW/MSVC).
|
||||
|
||||
2005-11-06 Vincent Richard <vincent@vincent-richard.net>
|
||||
|
||||
* Started version 0.8.1.
|
||||
|
@ -648,7 +648,18 @@ datetime::datetime(const datetime& d)
|
||||
|
||||
datetime::datetime(const time_t t, const int zone)
|
||||
{
|
||||
#ifdef _REENTRANT
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
// These functions are reentrant in MS C runtime library
|
||||
struct tm* gtm = gmtime(&t);
|
||||
struct tm* ltm = localtime(&t);
|
||||
|
||||
struct tm tms;
|
||||
|
||||
if (gtm)
|
||||
tms = *gtm;
|
||||
else if (ltm)
|
||||
tms = *ltm;
|
||||
#elif defined(_REENTRANT)
|
||||
struct tm tms;
|
||||
|
||||
if (!gmtime_r(&t, &tms))
|
||||
|
Loading…
Reference in New Issue
Block a user