]> git.saurik.com Git - wxWidgets.git/commitdiff
use wxLocaltime_r() instead of localtime(): this is safer and localtime() isn't avail...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 4 Nov 2006 23:20:20 +0000 (23:20 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 4 Nov 2006 23:20:20 +0000 (23:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43075 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/log.cpp
src/generic/logg.cpp

index c4d3ef212b5744023f02a31066af368d2bf0f397..b24d5dc538aec711bb2588e2e90d0c463ec45fb3 100644 (file)
@@ -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(": ");
index 50e1457c19b354350e8104ba7d823f22c414a8f3..ba6dd538f54467a45167ef9ab9b16986962e8e2e 100644 (file)
@@ -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"));