OLD | NEW |
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 POSIX goes here. This is not a platform on its | 5 // Platform-specific code for POSIX goes here. This is not a platform on its |
6 // own, but contains the parts which are the same across the POSIX platforms | 6 // own, but contains the parts which are the same across the POSIX platforms |
7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. | 7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. |
8 | 8 |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <limits.h> | 10 #include <limits.h> |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 391 |
392 | 392 |
393 void OS::ClearTimezoneCache(TimezoneCache* cache) { | 393 void OS::ClearTimezoneCache(TimezoneCache* cache) { |
394 DCHECK(cache == NULL); | 394 DCHECK(cache == NULL); |
395 } | 395 } |
396 | 396 |
397 | 397 |
398 double OS::DaylightSavingsOffset(double time, TimezoneCache*) { | 398 double OS::DaylightSavingsOffset(double time, TimezoneCache*) { |
399 if (std::isnan(time)) return std::numeric_limits<double>::quiet_NaN(); | 399 if (std::isnan(time)) return std::numeric_limits<double>::quiet_NaN(); |
400 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); | 400 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); |
401 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) | 401 struct tm tm; |
| 402 struct tm* t = localtime_r(&tv, &tm); |
402 if (NULL == t) return std::numeric_limits<double>::quiet_NaN(); | 403 if (NULL == t) return std::numeric_limits<double>::quiet_NaN(); |
403 return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; | 404 return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; |
404 } | 405 } |
405 | 406 |
406 | 407 |
407 int OS::GetLastError() { | 408 int OS::GetLastError() { |
408 return errno; | 409 return errno; |
409 } | 410 } |
410 | 411 |
411 | 412 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 | 764 |
764 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 765 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
765 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 766 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
766 int result = pthread_setspecific(pthread_key, value); | 767 int result = pthread_setspecific(pthread_key, value); |
767 DCHECK_EQ(0, result); | 768 DCHECK_EQ(0, result); |
768 USE(result); | 769 USE(result); |
769 } | 770 } |
770 | 771 |
771 } // namespace base | 772 } // namespace base |
772 } // namespace v8 | 773 } // namespace v8 |
OLD | NEW |