| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Dart core library. | 4 // Dart core library. |
| 5 | 5 |
| 6 class TimeZoneImplementation implements TimeZone { | 6 class TimeZoneImplementation implements TimeZone { |
| 7 const TimeZoneImplementation.utc() : isUtc = true; | 7 const TimeZoneImplementation.utc() : isUtc = true; |
| 8 TimeZoneImplementation.local() : isUtc = false {} | 8 TimeZoneImplementation.local() : isUtc = false {} |
| 9 | 9 |
| 10 bool operator ==(Object other) { | 10 bool operator ==(Object other) { |
| 11 if (!(other is TimeZoneImplementation)) return false; | 11 if (!(other is TimeZoneImplementation)) return false; |
| 12 return isUtc == other.isUtc; | 12 return isUtc == other.isUtc; |
| 13 } | 13 } |
| 14 | 14 |
| 15 final bool isUtc; | 15 final bool isUtc; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // JavaScript implementation of DateImplementation. | 18 // JavaScript implementation of DateImplementation. |
| 19 class DateImplementation implements Date { | 19 class DateImplementation implements Date { |
| 20 factory DateImplementation(int years, | 20 factory DateImplementation(int years, |
| 21 int month, | 21 [int month = 1, |
| 22 int day, | 22 int day = 1, |
| 23 int hours, | 23 int hours = 0, |
| 24 int minutes, | 24 int minutes = 0, |
| 25 int seconds, | 25 int seconds = 0, |
| 26 int milliseconds) { | 26 int milliseconds = 0]) { |
| 27 return new DateImplementation.withTimeZone( | 27 return new DateImplementation.withTimeZone( |
| 28 years, month, day, | 28 years, month, day, |
| 29 hours, minutes, seconds, milliseconds, | 29 hours, minutes, seconds, milliseconds, |
| 30 new TimeZoneImplementation.local()); | 30 new TimeZoneImplementation.local()); |
| 31 } | 31 } |
| 32 | 32 |
| 33 DateImplementation.withTimeZone(int years, | 33 DateImplementation.withTimeZone(int years, |
| 34 int month, | 34 int month, |
| 35 int day, | 35 int day, |
| 36 int hours, | 36 int hours, |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 406 |
| 407 static int getHours_(int secondsSinceEpoch, bool isUtc) | 407 static int getHours_(int secondsSinceEpoch, bool isUtc) |
| 408 native "DateNatives_getHours"; | 408 native "DateNatives_getHours"; |
| 409 | 409 |
| 410 static int getMinutes_(int secondsSinceEpoch, bool isUtc) | 410 static int getMinutes_(int secondsSinceEpoch, bool isUtc) |
| 411 native "DateNatives_getMinutes"; | 411 native "DateNatives_getMinutes"; |
| 412 | 412 |
| 413 static int getSeconds_(int secondsSinceEpoch, bool isUtc) | 413 static int getSeconds_(int secondsSinceEpoch, bool isUtc) |
| 414 native "DateNatives_getSeconds"; | 414 native "DateNatives_getSeconds"; |
| 415 } | 415 } |
| OLD | NEW |