OLD | NEW |
1 // Copyright (c) 2012, 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 // Dart core library. | 4 // Dart core library. |
5 | 5 |
6 // VM implementation of DateTime. | 6 // VM implementation of DateTime. |
7 patch class DateTime { | 7 patch class DateTime { |
| 8 // Natives. |
| 9 // The natives have been moved up here to work around Issue 10401. |
| 10 static int _getCurrentMs() native "DateNatives_currentTimeMillis"; |
| 11 |
| 12 static String _timeZoneNameForClampedSeconds(int secondsSinceEpoch) |
| 13 native "DateNatives_timeZoneName"; |
| 14 |
| 15 static int _timeZoneOffsetInSecondsForClampedSeconds(int secondsSinceEpoch) |
| 16 native "DateNatives_timeZoneOffsetInSeconds"; |
| 17 |
| 18 static int _localTimeZoneAdjustmentInSeconds() |
| 19 native "DateNatives_localTimeZoneAdjustmentInSeconds"; |
| 20 |
8 /* patch */ DateTime._internal(int year, | 21 /* patch */ DateTime._internal(int year, |
9 int month, | 22 int month, |
10 int day, | 23 int day, |
11 int hour, | 24 int hour, |
12 int minute, | 25 int minute, |
13 int second, | 26 int second, |
14 int millisecond, | 27 int millisecond, |
15 bool isUtc) | 28 bool isUtc) |
16 : this.isUtc = isUtc, | 29 : this.isUtc = isUtc, |
17 this.millisecondsSinceEpoch = _brokenDownDateToMillisecondsSinceEpoch( | 30 this.millisecondsSinceEpoch = _brokenDownDateToMillisecondsSinceEpoch( |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 316 |
304 static int _timeZoneOffsetInSeconds(int millisecondsSinceEpoch) { | 317 static int _timeZoneOffsetInSeconds(int millisecondsSinceEpoch) { |
305 int equivalentSeconds = _equivalentSeconds(millisecondsSinceEpoch); | 318 int equivalentSeconds = _equivalentSeconds(millisecondsSinceEpoch); |
306 return _timeZoneOffsetInSecondsForClampedSeconds(equivalentSeconds); | 319 return _timeZoneOffsetInSecondsForClampedSeconds(equivalentSeconds); |
307 } | 320 } |
308 | 321 |
309 static String _timeZoneName(int millisecondsSinceEpoch) { | 322 static String _timeZoneName(int millisecondsSinceEpoch) { |
310 int equivalentSeconds = _equivalentSeconds(millisecondsSinceEpoch); | 323 int equivalentSeconds = _equivalentSeconds(millisecondsSinceEpoch); |
311 return _timeZoneNameForClampedSeconds(equivalentSeconds); | 324 return _timeZoneNameForClampedSeconds(equivalentSeconds); |
312 } | 325 } |
313 | |
314 // Natives | |
315 static int _getCurrentMs() native "DateNatives_currentTimeMillis"; | |
316 | |
317 static String _timeZoneNameForClampedSeconds(int secondsSinceEpoch) | |
318 native "DateNatives_timeZoneName"; | |
319 | |
320 static int _timeZoneOffsetInSecondsForClampedSeconds(int secondsSinceEpoch) | |
321 native "DateNatives_timeZoneOffsetInSeconds"; | |
322 | |
323 static int _localTimeZoneAdjustmentInSeconds() | |
324 native "DateNatives_localTimeZoneAdjustmentInSeconds"; | |
325 } | 326 } |
OLD | NEW |