| 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) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 return Math.parseDouble(matched); | 77 return Math.parseDouble(matched); |
| 78 } | 78 } |
| 79 | 79 |
| 80 int years = Math.parseInt(match[1]); | 80 int years = Math.parseInt(match[1]); |
| 81 int month = Math.parseInt(match[2]); | 81 int month = Math.parseInt(match[2]); |
| 82 int day = Math.parseInt(match[3]); | 82 int day = Math.parseInt(match[3]); |
| 83 int hours = parseIntOrZero(match[4]); | 83 int hours = parseIntOrZero(match[4]); |
| 84 int minutes = parseIntOrZero(match[5]); | 84 int minutes = parseIntOrZero(match[5]); |
| 85 int seconds = parseIntOrZero(match[6]); | 85 int seconds = parseIntOrZero(match[6]); |
| 86 bool addOneMillisecond = false; | 86 bool addOneMillisecond = false; |
| 87 int milliseconds = (parseDoubleOrZero(match[7]) * 1000).round(); | 87 int milliseconds = (parseDoubleOrZero(match[7]) * 1000).round().toInt(); |
| 88 if (milliseconds == 1000) { | 88 if (milliseconds == 1000) { |
| 89 addOneMillisecond = true; | 89 addOneMillisecond = true; |
| 90 milliseconds = 999; | 90 milliseconds = 999; |
| 91 } | 91 } |
| 92 // TODO(floitsch): we should not need to test against the empty string. | 92 // TODO(floitsch): we should not need to test against the empty string. |
| 93 bool isUtc = (match[8] !== null) && (match[8] != ""); | 93 bool isUtc = (match[8] !== null) && (match[8] != ""); |
| 94 TimeZone timezone = isUtc ? const TimeZone.utc() : new TimeZone.local(); | 94 TimeZone timezone = isUtc ? const TimeZone.utc() : new TimeZone.local(); |
| 95 int epochValue = _brokenDownDateToMillisecondsSinceEpoch( | 95 int epochValue = _brokenDownDateToMillisecondsSinceEpoch( |
| 96 years, month, day, hours, minutes, seconds, milliseconds, isUtc); | 96 years, month, day, hours, minutes, seconds, milliseconds, isUtc); |
| 97 if (epochValue === null) { | 97 if (epochValue === null) { |
| (...skipping 308 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 |