| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 #include "vm/vtune.h" | 9 #include "vm/vtune.h" |
| 10 | 10 |
| 11 #include <malloc.h> // NOLINT | 11 #include <malloc.h> // NOLINT |
| 12 #include <process.h> // NOLINT |
| 12 #include <time.h> // NOLINT | 13 #include <time.h> // NOLINT |
| 13 | 14 |
| 14 #include "platform/utils.h" | 15 #include "platform/utils.h" |
| 15 #include "platform/assert.h" | 16 #include "platform/assert.h" |
| 16 | 17 |
| 17 namespace dart { | 18 namespace dart { |
| 18 | 19 |
| 19 const char* OS::Name() { | 20 const char* OS::Name() { |
| 20 return "windows"; | 21 return "windows"; |
| 21 } | 22 } |
| 22 | 23 |
| 23 | 24 |
| 25 intptr_t OS::ProcessId() { |
| 26 return static_cast<intptr_t>(GetCurrentProcessId()); |
| 27 } |
| 28 |
| 29 |
| 24 // As a side-effect sets the globals _timezone, _daylight and _tzname. | 30 // As a side-effect sets the globals _timezone, _daylight and _tzname. |
| 25 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { | 31 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { |
| 26 time_t seconds = static_cast<time_t>(seconds_since_epoch); | 32 time_t seconds = static_cast<time_t>(seconds_since_epoch); |
| 27 if (seconds != seconds_since_epoch) return false; | 33 if (seconds != seconds_since_epoch) return false; |
| 28 // localtime_s implicitly sets _timezone, _daylight and _tzname. | 34 // localtime_s implicitly sets _timezone, _daylight and _tzname. |
| 29 errno_t error_code = localtime_s(tm_result, &seconds); | 35 errno_t error_code = localtime_s(tm_result, &seconds); |
| 30 return error_code == 0; | 36 return error_code == 0; |
| 31 } | 37 } |
| 32 | 38 |
| 33 | 39 |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 } | 317 } |
| 312 | 318 |
| 313 | 319 |
| 314 void OS::Exit(int code) { | 320 void OS::Exit(int code) { |
| 315 exit(code); | 321 exit(code); |
| 316 } | 322 } |
| 317 | 323 |
| 318 } // namespace dart | 324 } // namespace dart |
| 319 | 325 |
| 320 #endif // defined(TARGET_OS_WINDOWS) | 326 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |