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 Linux goes here. For the POSIX-compatible | 5 // Platform-specific code for Linux 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 <pthread.h> | 8 #include <pthread.h> |
9 #include <semaphore.h> | 9 #include <semaphore.h> |
10 #include <signal.h> | 10 #include <signal.h> |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 #endif // def __arm__ | 101 #endif // def __arm__ |
102 | 102 |
103 | 103 |
104 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { | 104 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { |
105 #if V8_OS_NACL | 105 #if V8_OS_NACL |
106 // Missing support for tm_zone field. | 106 // Missing support for tm_zone field. |
107 return ""; | 107 return ""; |
108 #else | 108 #else |
109 if (std::isnan(time)) return ""; | 109 if (std::isnan(time)) return ""; |
110 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); | 110 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); |
111 struct tm* t = localtime(&tv); | 111 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
112 if (!t || !t->tm_zone) return ""; | 112 if (!t || !t->tm_zone) return ""; |
113 return t->tm_zone; | 113 return t->tm_zone; |
114 #endif | 114 #endif |
115 } | 115 } |
116 | 116 |
117 | 117 |
118 double OS::LocalTimeOffset(TimezoneCache* cache) { | 118 double OS::LocalTimeOffset(TimezoneCache* cache) { |
119 #if V8_OS_NACL | 119 #if V8_OS_NACL |
120 // Missing support for tm_zone field. | 120 // Missing support for tm_zone field. |
121 return 0; | 121 return 0; |
122 #else | 122 #else |
123 time_t tv = time(NULL); | 123 time_t tv = time(NULL); |
124 struct tm* t = localtime(&tv); | 124 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
125 // tm_gmtoff includes any daylight savings offset, so subtract it. | 125 // tm_gmtoff includes any daylight savings offset, so subtract it. |
126 return static_cast<double>(t->tm_gmtoff * msPerSecond - | 126 return static_cast<double>(t->tm_gmtoff * msPerSecond - |
127 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); | 127 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); |
128 #endif | 128 #endif |
129 } | 129 } |
130 | 130 |
131 | 131 |
132 void* OS::Allocate(const size_t requested, | 132 void* OS::Allocate(const size_t requested, |
133 size_t* allocated, | 133 size_t* allocated, |
134 bool is_executable) { | 134 bool is_executable) { |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 #endif | 382 #endif |
383 return munmap(base, size) == 0; | 383 return munmap(base, size) == 0; |
384 } | 384 } |
385 | 385 |
386 | 386 |
387 bool VirtualMemory::HasLazyCommits() { | 387 bool VirtualMemory::HasLazyCommits() { |
388 return true; | 388 return true; |
389 } | 389 } |
390 | 390 |
391 } } // namespace v8::base | 391 } } // namespace v8::base |
OLD | NEW |