OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 QNX goes here. For the POSIX-compatible | 5 // Platform-specific code for QNX 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 #include <backtrace.h> | 8 #include <backtrace.h> |
9 #include <pthread.h> | 9 #include <pthread.h> |
10 #include <semaphore.h> | 10 #include <semaphore.h> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 #endif | 81 #endif |
82 #undef GCC_VERSION | 82 #undef GCC_VERSION |
83 } | 83 } |
84 | 84 |
85 #endif // __arm__ | 85 #endif // __arm__ |
86 | 86 |
87 | 87 |
88 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { | 88 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { |
89 if (std::isnan(time)) return ""; | 89 if (std::isnan(time)) return ""; |
90 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); | 90 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); |
91 struct tm* t = localtime(&tv); | 91 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
92 if (NULL == t) return ""; | 92 if (NULL == t) return ""; |
93 return t->tm_zone; | 93 return t->tm_zone; |
94 } | 94 } |
95 | 95 |
96 | 96 |
97 double OS::LocalTimeOffset(TimezoneCache* cache) { | 97 double OS::LocalTimeOffset(TimezoneCache* cache) { |
98 time_t tv = time(NULL); | 98 time_t tv = time(NULL); |
99 struct tm* t = localtime(&tv); | 99 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
100 // tm_gmtoff includes any daylight savings offset, so subtract it. | 100 // tm_gmtoff includes any daylight savings offset, so subtract it. |
101 return static_cast<double>(t->tm_gmtoff * msPerSecond - | 101 return static_cast<double>(t->tm_gmtoff * msPerSecond - |
102 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); | 102 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); |
103 } | 103 } |
104 | 104 |
105 | 105 |
106 void* OS::Allocate(const size_t requested, | 106 void* OS::Allocate(const size_t requested, |
107 size_t* allocated, | 107 size_t* allocated, |
108 bool is_executable) { | 108 bool is_executable) { |
109 const size_t msize = RoundUp(requested, AllocateAlignment()); | 109 const size_t msize = RoundUp(requested, AllocateAlignment()); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { | 306 bool VirtualMemory::ReleaseRegion(void* base, size_t size) { |
307 return munmap(base, size) == 0; | 307 return munmap(base, size) == 0; |
308 } | 308 } |
309 | 309 |
310 | 310 |
311 bool VirtualMemory::HasLazyCommits() { | 311 bool VirtualMemory::HasLazyCommits() { |
312 return false; | 312 return false; |
313 } | 313 } |
314 | 314 |
315 } } // namespace v8::base | 315 } } // namespace v8::base |
OLD | NEW |