summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 00:03:43 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 00:03:43 +0000
commitdefcd8f33aff9c637baa17a50dcee733055c8c3e (patch)
tree282c99db45c94915fdba0d9c54b2484ec2418b16 /base
parenta1390e34ecb69f4e1840788dd86a3912cbbc2e7e (diff)
downloadchromium_src-defcd8f33aff9c637baa17a50dcee733055c8c3e.zip
chromium_src-defcd8f33aff9c637baa17a50dcee733055c8c3e.tar.gz
chromium_src-defcd8f33aff9c637baa17a50dcee733055c8c3e.tar.bz2
Use thread-safe localtime_r instead of localtime.
BUG=11588 Review URL: http://codereview.chromium.org/115272 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15922 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/logging.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/base/logging.cc b/base/logging.cc
index 7b89020..7420883 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -395,14 +395,14 @@ void LogMessage::Init(const char* file, int line) {
if (log_thread_id)
stream_ << CurrentThreadId() << ':';
if (log_timestamp) {
- time_t t = time(NULL);
-#if _MSC_VER >= 1400
+ time_t t = time(NULL);
struct tm local_time = {0};
+#if _MSC_VER >= 1400
localtime_s(&local_time, &t);
- struct tm* tm_time = &local_time;
#else
- struct tm* tm_time = localtime(&t);
+ localtime_r(&t, &local_time);
#endif
+ struct tm* tm_time = &local_time;
stream_ << std::setfill('0')
<< std::setw(2) << 1 + tm_time->tm_mon
<< std::setw(2) << tm_time->tm_mday