diff --git a/src/common/log.cpp b/src/common/log.cpp index c4d3ef212b..b24d5dc538 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -416,7 +416,10 @@ void wxLog::TimeStamp(wxString *str) wxChar buf[256]; time_t timeNow; (void)time(&timeNow); - wxStrftime(buf, WXSIZEOF(buf), ms_timestamp, localtime(&timeNow)); + + struct tm tm; + wxStrftime(buf, WXSIZEOF(buf), + ms_timestamp, wxLocaltime_r(&timeNow, &tm)); str->Empty(); *str << buf << wxT(": "); diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index 50e1457c19..ba6dd538f5 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -82,7 +82,8 @@ static wxString TimeStamp(const wxChar *format, time_t t) { wxChar buf[4096]; - if ( !wxStrftime(buf, WXSIZEOF(buf), format, localtime(&t)) ) + struct tm tm; + if ( !wxStrftime(buf, WXSIZEOF(buf), format, wxLocaltime_r(&t, &tm)) ) { // buffer is too small? wxFAIL_MSG(_T("strftime() failed"));