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

Side by Side Diff: sdk/lib/core/date_time.dart

Issue 12317107: ceil/floor/truncate/round return integers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload due to error3 Created 7 years, 9 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
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 4
5 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * A DateTime object represents a point in time. 8 * A DateTime object represents a point in time.
9 * 9 *
10 * It can represent time values that are at a distance of at most 10 * It can represent time values that are at a distance of at most
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return double.parse(matched); 128 return double.parse(matched);
129 } 129 }
130 130
131 int years = int.parse(match[1]); 131 int years = int.parse(match[1]);
132 int month = int.parse(match[2]); 132 int month = int.parse(match[2]);
133 int day = int.parse(match[3]); 133 int day = int.parse(match[3]);
134 int hour = parseIntOrZero(match[4]); 134 int hour = parseIntOrZero(match[4]);
135 int minute = parseIntOrZero(match[5]); 135 int minute = parseIntOrZero(match[5]);
136 int second = parseIntOrZero(match[6]); 136 int second = parseIntOrZero(match[6]);
137 bool addOneMillisecond = false; 137 bool addOneMillisecond = false;
138 int millisecond = (parseDoubleOrZero(match[7]) * 1000).round().toInt(); 138 int millisecond = (parseDoubleOrZero(match[7]) * 1000).round();
139 if (millisecond == 1000) { 139 if (millisecond == 1000) {
140 addOneMillisecond = true; 140 addOneMillisecond = true;
141 millisecond = 999; 141 millisecond = 999;
142 } 142 }
143 // TODO(floitsch): we should not need to test against the empty string. 143 // TODO(floitsch): we should not need to test against the empty string.
144 bool isUtc = (match[8] != null) && (match[8] != ""); 144 bool isUtc = (match[8] != null) && (match[8] != "");
145 int millisecondsSinceEpoch = _brokenDownDateToMillisecondsSinceEpoch( 145 int millisecondsSinceEpoch = _brokenDownDateToMillisecondsSinceEpoch(
146 years, month, day, hour, minute, second, millisecond, isUtc); 146 years, month, day, hour, minute, second, millisecond, isUtc);
147 if (millisecondsSinceEpoch == null) { 147 if (millisecondsSinceEpoch == null) {
148 throw new ArgumentError(formattedString); 148 throw new ArgumentError(formattedString);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 * Returns the millisecond into the second [0...999]. 412 * Returns the millisecond into the second [0...999].
413 */ 413 */
414 external int get millisecond; 414 external int get millisecond;
415 415
416 /** 416 /**
417 * Returns the week day [MON..SUN]. In accordance with ISO 8601 417 * Returns the week day [MON..SUN]. In accordance with ISO 8601
418 * a week starts with Monday which has the value 1. 418 * a week starts with Monday which has the value 1.
419 */ 419 */
420 external int get weekday; 420 external int get weekday;
421 } 421 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/tools/mini_parser.dart ('k') | sdk/lib/core/double.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698