| 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 OpenBSD and NetBSD goes here. For the | 5 // Platform-specific code for OpenBSD and NetBSD goes here. For the |
| 6 // POSIX-compatible parts, the implementation is in platform-posix.cc. | 6 // POSIX-compatible 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 19 matching lines...) Expand all Loading... |
| 30 #include "src/base/platform/platform.h" | 30 #include "src/base/platform/platform.h" |
| 31 | 31 |
| 32 | 32 |
| 33 namespace v8 { | 33 namespace v8 { |
| 34 namespace base { | 34 namespace base { |
| 35 | 35 |
| 36 | 36 |
| 37 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { | 37 const char* OS::LocalTimezone(double time, TimezoneCache* cache) { |
| 38 if (std::isnan(time)) return ""; | 38 if (std::isnan(time)) return ""; |
| 39 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); | 39 time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); |
| 40 struct tm* t = localtime(&tv); | 40 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
| 41 if (NULL == t) return ""; | 41 if (NULL == t) return ""; |
| 42 return t->tm_zone; | 42 return t->tm_zone; |
| 43 } | 43 } |
| 44 | 44 |
| 45 | 45 |
| 46 double OS::LocalTimeOffset(TimezoneCache* cache) { | 46 double OS::LocalTimeOffset(TimezoneCache* cache) { |
| 47 time_t tv = time(NULL); | 47 time_t tv = time(NULL); |
| 48 struct tm* t = localtime(&tv); | 48 struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn) |
| 49 // tm_gmtoff includes any daylight savings offset, so subtract it. | 49 // tm_gmtoff includes any daylight savings offset, so subtract it. |
| 50 return static_cast<double>(t->tm_gmtoff * msPerSecond - | 50 return static_cast<double>(t->tm_gmtoff * msPerSecond - |
| 51 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); | 51 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 void* OS::Allocate(const size_t requested, | 55 void* OS::Allocate(const size_t requested, |
| 56 size_t* allocated, | 56 size_t* allocated, |
| 57 bool is_executable) { | 57 bool is_executable) { |
| 58 const size_t msize = RoundUp(requested, AllocateAlignment()); | 58 const size_t msize = RoundUp(requested, AllocateAlignment()); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 return munmap(base, size) == 0; | 280 return munmap(base, size) == 0; |
| 281 } | 281 } |
| 282 | 282 |
| 283 | 283 |
| 284 bool VirtualMemory::HasLazyCommits() { | 284 bool VirtualMemory::HasLazyCommits() { |
| 285 // TODO(alph): implement for the platform. | 285 // TODO(alph): implement for the platform. |
| 286 return false; | 286 return false; |
| 287 } | 287 } |
| 288 | 288 |
| 289 } } // namespace v8::base | 289 } } // namespace v8::base |
| OLD | NEW |