Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: src/base/platform/platform-solaris.cc

Issue 2184673002: [base] Use thread safe localtime_r() instead of localtime(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/base/platform/platform-qnx.cc ('k') | src/base/platform/platform-win32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Platform-specific code for Solaris 10 goes here. For the POSIX-compatible 5 // Platform-specific code for Solaris 10 goes here. For the POSIX-compatible
6 // parts, the implementation is in platform-posix.cc. 6 // parts, the implementation is in platform-posix.cc.
7 7
8 #ifdef __sparc 8 #ifdef __sparc
9 # error "V8 does not support the SPARC CPU architecture." 9 # error "V8 does not support the SPARC CPU architecture."
10 #endif 10 #endif
(...skipping 20 matching lines...) Expand all
31 #include "src/base/platform/platform.h" 31 #include "src/base/platform/platform.h"
32 32
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace base { 35 namespace base {
36 36
37 37
38 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { 38 const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
39 if (std::isnan(time)) return ""; 39 if (std::isnan(time)) return "";
40 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); 40 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
41 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) 41 struct tm tm;
42 struct tm* t = localtime_r(&tv, &tm);
42 if (NULL == t) return ""; 43 if (NULL == t) return "";
43 return tzname[0]; // The location of the timezone string on Solaris. 44 return tzname[0]; // The location of the timezone string on Solaris.
44 } 45 }
45 46
46 47
47 double OS::LocalTimeOffset(TimezoneCache* cache) { 48 double OS::LocalTimeOffset(TimezoneCache* cache) {
48 tzset(); 49 tzset();
49 return -static_cast<double>(timezone * msPerSecond); 50 return -static_cast<double>(timezone * msPerSecond);
50 } 51 }
51 52
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 204 }
204 205
205 206
206 bool VirtualMemory::HasLazyCommits() { 207 bool VirtualMemory::HasLazyCommits() {
207 // TODO(alph): implement for the platform. 208 // TODO(alph): implement for the platform.
208 return false; 209 return false;
209 } 210 }
210 211
211 } // namespace base 212 } // namespace base
212 } // namespace v8 213 } // namespace v8
OLDNEW
« no previous file with comments | « src/base/platform/platform-qnx.cc ('k') | src/base/platform/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698