| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 String fourDigits(int n) { | 212 String fourDigits(int n) { |
| 213 int absN = n.abs(); | 213 int absN = n.abs(); |
| 214 String sign = n < 0 ? "-" : ""; | 214 String sign = n < 0 ? "-" : ""; |
| 215 if (absN >= 1000) return "$n"; | 215 if (absN >= 1000) return "$n"; |
| 216 if (absN >= 100) return "${sign}0$absN"; | 216 if (absN >= 100) return "${sign}0$absN"; |
| 217 if (absN >= 10) return "${sign}00$absN"; | 217 if (absN >= 10) return "${sign}00$absN"; |
| 218 if (absN >= 1) return "${sign}000$absN"; | 218 if (absN >= 1) return "${sign}000$absN"; |
| 219 } | 219 } |
| 220 String threeDigits(int n) { | 220 String threeDigits(int n) { |
| 221 if (n >= 100) return "${n}"; | 221 if (n >= 100) return "${n}"; |
| 222 if (n > 10) return "0${n}"; | 222 if (n >= 10) return "0${n}"; |
| 223 return "00${n}"; | 223 return "00${n}"; |
| 224 } | 224 } |
| 225 String twoDigits(int n) { | 225 String twoDigits(int n) { |
| 226 if (n >= 10) return "${n}"; | 226 if (n >= 10) return "${n}"; |
| 227 return "0${n}"; | 227 return "0${n}"; |
| 228 } | 228 } |
| 229 | 229 |
| 230 String y = fourDigits(year); | 230 String y = fourDigits(year); |
| 231 String m = twoDigits(month); | 231 String m = twoDigits(month); |
| 232 String d = twoDigits(day); | 232 String d = twoDigits(day); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 416 |
| 417 static int getHours_(int secondsSinceEpoch, bool isUtc) | 417 static int getHours_(int secondsSinceEpoch, bool isUtc) |
| 418 native "DateNatives_getHours"; | 418 native "DateNatives_getHours"; |
| 419 | 419 |
| 420 static int getMinutes_(int secondsSinceEpoch, bool isUtc) | 420 static int getMinutes_(int secondsSinceEpoch, bool isUtc) |
| 421 native "DateNatives_getMinutes"; | 421 native "DateNatives_getMinutes"; |
| 422 | 422 |
| 423 static int getSeconds_(int secondsSinceEpoch, bool isUtc) | 423 static int getSeconds_(int secondsSinceEpoch, bool isUtc) |
| 424 native "DateNatives_getSeconds"; | 424 native "DateNatives_getSeconds"; |
| 425 } | 425 } |
| OLD | NEW |