| 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 // VM implementation of DateImplementation. | 6 // VM implementation of DateImplementation. |
| 7 class DateImplementation implements Date { | 7 class DateImplementation implements Date { |
| 8 static final int _MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000; | 8 static final int _MAX_MILLISECONDS_SINCE_EPOCH = 8640000000000000; |
| 9 | 9 |
| 10 DateImplementation(int years, | 10 DateImplementation(int years, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 Date.MON; | 189 Date.MON; |
| 190 } | 190 } |
| 191 | 191 |
| 192 String toString() { | 192 String toString() { |
| 193 String fourDigits(int n) { | 193 String fourDigits(int n) { |
| 194 int absN = n.abs(); | 194 int absN = n.abs(); |
| 195 String sign = n < 0 ? "-" : ""; | 195 String sign = n < 0 ? "-" : ""; |
| 196 if (absN >= 1000) return "$n"; | 196 if (absN >= 1000) return "$n"; |
| 197 if (absN >= 100) return "${sign}0$absN"; | 197 if (absN >= 100) return "${sign}0$absN"; |
| 198 if (absN >= 10) return "${sign}00$absN"; | 198 if (absN >= 10) return "${sign}00$absN"; |
| 199 if (absN >= 1) return "${sign}000$absN"; | 199 return "${sign}000$absN"; |
| 200 } | 200 } |
| 201 String threeDigits(int n) { | 201 String threeDigits(int n) { |
| 202 if (n >= 100) return "${n}"; | 202 if (n >= 100) return "${n}"; |
| 203 if (n >= 10) return "0${n}"; | 203 if (n >= 10) return "0${n}"; |
| 204 return "00${n}"; | 204 return "00${n}"; |
| 205 } | 205 } |
| 206 String twoDigits(int n) { | 206 String twoDigits(int n) { |
| 207 if (n >= 10) return "${n}"; | 207 if (n >= 10) return "${n}"; |
| 208 return "0${n}"; | 208 return "0${n}"; |
| 209 } | 209 } |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 483 |
| 484 static String _timeZoneNameForClampedSeconds(int secondsSinceEpoch) | 484 static String _timeZoneNameForClampedSeconds(int secondsSinceEpoch) |
| 485 native "DateNatives_timeZoneName"; | 485 native "DateNatives_timeZoneName"; |
| 486 | 486 |
| 487 static int _timeZoneOffsetInSecondsForClampedSeconds(int secondsSinceEpoch) | 487 static int _timeZoneOffsetInSecondsForClampedSeconds(int secondsSinceEpoch) |
| 488 native "DateNatives_timeZoneOffsetInSeconds"; | 488 native "DateNatives_timeZoneOffsetInSeconds"; |
| 489 | 489 |
| 490 static int _localTimeZoneAdjustmentInSeconds() | 490 static int _localTimeZoneAdjustmentInSeconds() |
| 491 native "DateNatives_localTimeZoneAdjustmentInSeconds"; | 491 native "DateNatives_localTimeZoneAdjustmentInSeconds"; |
| 492 } | 492 } |
| OLD | NEW |