Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, 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/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/native_entry.h" | 8 #include "vm/native_entry.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/os.h" | 10 #include "vm/os.h" |
| 11 | 11 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 33 UNIMPLEMENTED(); | 33 UNIMPLEMENTED(); |
| 34 } | 34 } |
| 35 Smi& smi_years = Smi::Handle(); | 35 Smi& smi_years = Smi::Handle(); |
| 36 smi_years ^= dart_years.raw(); | 36 smi_years ^= dart_years.raw(); |
| 37 OS::BrokenDownDate broken_down; | 37 OS::BrokenDownDate broken_down; |
| 38 // mktime takes the years since 1900. | 38 // mktime takes the years since 1900. |
| 39 // TODO(floitsch): Removing 1900 could underflow the intptr_t. | 39 // TODO(floitsch): Removing 1900 could underflow the intptr_t. |
| 40 intptr_t year = smi_years.Value() - 1900; | 40 intptr_t year = smi_years.Value() - 1900; |
| 41 // TODO(floitsch): We don't handle the case yet where intptr_t and int have | 41 // TODO(floitsch): We don't handle the case yet where intptr_t and int have |
| 42 // different sizes. | 42 // different sizes. |
| 43 ASSERT(sizeof(year) <= sizeof(broken_down.year)); | 43 // See issue 1143. |
|
Ivan Posva
2012/01/12 22:27:31
How about changing the TODO above to TODO(1143) in
regis
2012/01/12 22:53:37
Done. Also added a static cast to make the convers
| |
| 44 // ASSERT(sizeof(year) <= sizeof(broken_down.year)); | |
| 44 broken_down.year = year; | 45 broken_down.year = year; |
| 45 // libc months are 0-based (contrary to Dart' 1-based months). | 46 // libc months are 0-based (contrary to Dart' 1-based months). |
| 46 broken_down.month = dart_month.Value() - 1; | 47 broken_down.month = dart_month.Value() - 1; |
| 47 broken_down.day = dart_day.Value(); | 48 broken_down.day = dart_day.Value(); |
| 48 broken_down.hours = dart_hours.Value(); | 49 broken_down.hours = dart_hours.Value(); |
| 49 broken_down.minutes = dart_minutes.Value(); | 50 broken_down.minutes = dart_minutes.Value(); |
| 50 broken_down.seconds = dart_seconds.Value(); | 51 broken_down.seconds = dart_seconds.Value(); |
| 51 time_t value; | 52 time_t value; |
| 52 bool succeeded = OS::BrokenDownToSecondsSinceEpoch(broken_down, | 53 bool succeeded = OS::BrokenDownToSecondsSinceEpoch(broken_down, |
| 53 dart_is_utc.value(), | 54 dart_is_utc.value(), |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 bool succeeded = | 147 bool succeeded = |
| 147 BreakDownSecondsSinceEpoch(dart_seconds, dart_is_utc, &broken_down); | 148 BreakDownSecondsSinceEpoch(dart_seconds, dart_is_utc, &broken_down); |
| 148 if (!succeeded) { | 149 if (!succeeded) { |
| 149 UNIMPLEMENTED(); | 150 UNIMPLEMENTED(); |
| 150 } | 151 } |
| 151 const Smi& result = Smi::Handle(Smi::New(broken_down.seconds)); | 152 const Smi& result = Smi::Handle(Smi::New(broken_down.seconds)); |
| 152 arguments->SetReturn(result); | 153 arguments->SetReturn(result); |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace dart | 156 } // namespace dart |
| OLD | NEW |