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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 | 378 |
379 void OS::ClearTimezoneCache(TimezoneCache* cache) { | 379 void OS::ClearTimezoneCache(TimezoneCache* cache) { |
380 DCHECK(cache == NULL); | 380 DCHECK(cache == NULL); |
381 } | 381 } |
382 | 382 |
383 | 383 |
384 double OS::DaylightSavingsOffset(double time, TimezoneCache*) { | 384 double OS::DaylightSavingsOffset(double time, TimezoneCache*) { |
385 if (std::isnan(time)) return std::numeric_limits<double>::quiet_NaN(); | 385 if (std::isnan(time)) return std::numeric_limits<double>::quiet_NaN(); |
386 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); | 386 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); |
387 struct tm* t = localtime(&tv); | 387 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
388 if (NULL == t) return std::numeric_limits<double>::quiet_NaN(); | 388 if (NULL == t) return std::numeric_limits<double>::quiet_NaN(); |
389 return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; | 389 return t->tm_isdst > 0 ? 3600 * msPerSecond : 0; |
390 } | 390 } |
391 | 391 |
392 | 392 |
393 int OS::GetLastError() { | 393 int OS::GetLastError() { |
394 return errno; | 394 return errno; |
395 } | 395 } |
396 | 396 |
397 | 397 |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 | 748 |
749 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 749 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
750 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 750 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
751 int result = pthread_setspecific(pthread_key, value); | 751 int result = pthread_setspecific(pthread_key, value); |
752 DCHECK_EQ(0, result); | 752 DCHECK_EQ(0, result); |
753 USE(result); | 753 USE(result); |
754 } | 754 } |
755 | 755 |
756 } // namespace base | 756 } // namespace base |
757 } // namespace v8 | 757 } // namespace v8 |
OLD | NEW |