X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dcc40ba510c46c55bf35e51347957a107517ecfd..30083ad8e7c0eb9ea3dcf4f2588149eeb7fe3e32:/src/common/log.cpp?ds=sidebyside diff --git a/src/common/log.cpp b/src/common/log.cpp index c4d3ef212b..0687124fe8 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -37,6 +37,7 @@ #endif //WX_PRECOMP #include "wx/apptrait.h" +#include "wx/datetime.h" #include "wx/file.h" #include "wx/msgout.h" #include "wx/textfile.h" @@ -328,7 +329,7 @@ void wxLog::OnLog(wxLogLevel level, const wxChar *szString, time_t t) { if ( GetRepetitionCounting() ) { - pLogger->DoLogNumberOfRepeats(); + DoLogNumberOfRepeats(); } ms_prevString = szString; ms_prevLevel = level; @@ -411,16 +412,21 @@ void wxLog::ClearTraceMasks() void wxLog::TimeStamp(wxString *str) { +#if wxUSE_DATETIME if ( ms_timestamp ) { 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(": "); } +#endif // wxUSE_DATETIME } void wxLog::DoLog(wxLogLevel level, const wxChar *szString, time_t t) @@ -549,8 +555,8 @@ void wxLogStderr::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) TimeStamp(&str); str << szString; - fputs(str.mb_str(), m_fp); - fputc(_T('\n'), m_fp); + wxFputs(str, m_fp); + wxFputc(_T('\n'), m_fp); fflush(m_fp); // under GUI systems such as Windows or Mac, programs usually don't have