| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #if defined(FLETCH_TARGET_OS_MACOS) | 5 #if defined(DARTINO_TARGET_OS_MACOS) |
| 6 | 6 |
| 7 #include <mach-o/dyld.h> | 7 #include <mach-o/dyld.h> |
| 8 | 8 |
| 9 #include <CoreFoundation/CFTimeZone.h> | 9 #include <CoreFoundation/CFTimeZone.h> |
| 10 | 10 |
| 11 #include "src/shared/assert.h" | 11 #include "src/shared/assert.h" |
| 12 #include "src/shared/platform.h" | 12 #include "src/shared/platform.h" |
| 13 | 13 |
| 14 namespace fletch { | 14 namespace dartino { |
| 15 | 15 |
| 16 void GetPathOfExecutable(char* path, size_t path_length) { | 16 void GetPathOfExecutable(char* path, size_t path_length) { |
| 17 uint32_t bytes_copied = path_length; | 17 uint32_t bytes_copied = path_length; |
| 18 if (_NSGetExecutablePath(path, &bytes_copied) != 0) { | 18 if (_NSGetExecutablePath(path, &bytes_copied) != 0) { |
| 19 FATAL1("_NSGetExecutablePath failed, %u bytes left.", bytes_copied); | 19 FATAL1("_NSGetExecutablePath failed, %u bytes left.", bytes_copied); |
| 20 } | 20 } |
| 21 } | 21 } |
| 22 | 22 |
| 23 int Platform::GetLocalTimeZoneOffset() { | 23 int Platform::GetLocalTimeZoneOffset() { |
| 24 CFTimeZoneRef tz = CFTimeZoneCopySystem(); | 24 CFTimeZoneRef tz = CFTimeZoneCopySystem(); |
| 25 // Even if the offset was 24 hours it would still easily fit into 32 bits. | 25 // Even if the offset was 24 hours it would still easily fit into 32 bits. |
| 26 int offset = CFTimeZoneGetSecondsFromGMT(tz, CFAbsoluteTimeGetCurrent()); | 26 int offset = CFTimeZoneGetSecondsFromGMT(tz, CFAbsoluteTimeGetCurrent()); |
| 27 CFRelease(tz); | 27 CFRelease(tz); |
| 28 // Note that Unix and Dart disagree on the sign. | 28 // Note that Unix and Dart disagree on the sign. |
| 29 return static_cast<int>(-offset); | 29 return static_cast<int>(-offset); |
| 30 } | 30 } |
| 31 | 31 |
| 32 } // namespace fletch | 32 } // namespace dartino |
| 33 | 33 |
| 34 #endif // defined(FLETCH_TARGET_OS_MACOS) | 34 #endif // defined(DARTINO_TARGET_OS_MACOS) |
| OLD | NEW |