use wxLocaltime_r() instead of localtime(): this is safer and localtime() isn't available under WinCE while wxLocaltime_r() is always available
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43075 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -416,7 +416,10 @@ void wxLog::TimeStamp(wxString *str)
|
|||||||
wxChar buf[256];
|
wxChar buf[256];
|
||||||
time_t timeNow;
|
time_t timeNow;
|
||||||
(void)time(&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->Empty();
|
||||||
*str << buf << wxT(": ");
|
*str << buf << wxT(": ");
|
||||||
|
@@ -82,7 +82,8 @@
|
|||||||
static wxString TimeStamp(const wxChar *format, time_t t)
|
static wxString TimeStamp(const wxChar *format, time_t t)
|
||||||
{
|
{
|
||||||
wxChar buf[4096];
|
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?
|
// buffer is too small?
|
||||||
wxFAIL_MSG(_T("strftime() failed"));
|
wxFAIL_MSG(_T("strftime() failed"));
|
||||||
|
Reference in New Issue
Block a user