Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Side by Side Diff: runtime/lib/date.dart

Issue 10537086: new Date.now() should be in local timezone. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/corelib/date_time_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 _SECONDS_YEAR_2035 = 2051222400; 8 static final int _SECONDS_YEAR_2035 = 2051222400;
9 9
10 DateImplementation(int years, 10 DateImplementation(int years,
11 [int month = 1, 11 [int month = 1,
12 int day = 1, 12 int day = 1,
13 int hours = 0, 13 int hours = 0,
14 int minutes = 0, 14 int minutes = 0,
15 int seconds = 0, 15 int seconds = 0,
16 int milliseconds = 0, 16 int milliseconds = 0,
17 bool isUtc = false]) 17 bool isUtc = false])
18 : _isUtc = isUtc, 18 : _isUtc = isUtc,
19 value = _brokenDownDateToMillisecondsSinceEpoch( 19 value = _brokenDownDateToMillisecondsSinceEpoch(
20 years, month, day, hours, minutes, seconds, milliseconds, isUtc) { 20 years, month, day, hours, minutes, seconds, milliseconds, isUtc) {
21 if (value === null) throw new IllegalArgumentException(); 21 if (value === null) throw new IllegalArgumentException();
22 } 22 }
23 23
24 DateImplementation.now() 24 DateImplementation.now()
25 : _isUtc = true, 25 : _isUtc = false,
26 value = _getCurrentMs() { 26 value = _getCurrentMs() {
27 } 27 }
28 28
29 factory DateImplementation.fromString(String formattedString) { 29 factory DateImplementation.fromString(String formattedString) {
30 // Read in (a subset of) ISO 8601. 30 // Read in (a subset of) ISO 8601.
31 // Examples: 31 // Examples:
32 // - "2012-02-27 13:27:00" 32 // - "2012-02-27 13:27:00"
33 // - "2012-02-27 13:27:00.423z" 33 // - "2012-02-27 13:27:00.423z"
34 // - "20120227 13:27:00" 34 // - "20120227 13:27:00"
35 // - "20120227T132700" 35 // - "20120227T132700"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 static int _getHours(int secondsSinceEpoch, bool isUtc) 403 static int _getHours(int secondsSinceEpoch, bool isUtc)
404 native "DateNatives_getHours"; 404 native "DateNatives_getHours";
405 405
406 static int _getMinutes(int secondsSinceEpoch, bool isUtc) 406 static int _getMinutes(int secondsSinceEpoch, bool isUtc)
407 native "DateNatives_getMinutes"; 407 native "DateNatives_getMinutes";
408 408
409 static int _getSeconds(int secondsSinceEpoch, bool isUtc) 409 static int _getSeconds(int secondsSinceEpoch, bool isUtc)
410 native "DateNatives_getSeconds"; 410 native "DateNatives_getSeconds";
411 } 411 }
OLDNEW
« no previous file with comments | « no previous file | tests/corelib/date_time_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698