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

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: Some fixes from CL 11748016. 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 * Deprecated class. Please use [DateTime] instead. 8 * Deprecated class. Please use [DateTime] instead.
9 */ 9 */
10 @deprecated 10 @deprecated
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 return double.parse(matched); 223 return double.parse(matched);
224 } 224 }
225 225
226 int years = int.parse(match[1]); 226 int years = int.parse(match[1]);
227 int month = int.parse(match[2]); 227 int month = int.parse(match[2]);
228 int day = int.parse(match[3]); 228 int day = int.parse(match[3]);
229 int hour = parseIntOrZero(match[4]); 229 int hour = parseIntOrZero(match[4]);
230 int minute = parseIntOrZero(match[5]); 230 int minute = parseIntOrZero(match[5]);
231 int second = parseIntOrZero(match[6]); 231 int second = parseIntOrZero(match[6]);
232 bool addOneMillisecond = false; 232 bool addOneMillisecond = false;
233 int millisecond = (parseDoubleOrZero(match[7]) * 1000).round().toInt(); 233 int millisecond = (parseDoubleOrZero(match[7]) * 1000).round();
234 if (millisecond == 1000) { 234 if (millisecond == 1000) {
235 addOneMillisecond = true; 235 addOneMillisecond = true;
236 millisecond = 999; 236 millisecond = 999;
237 } 237 }
238 // TODO(floitsch): we should not need to test against the empty string. 238 // TODO(floitsch): we should not need to test against the empty string.
239 bool isUtc = (match[8] != null) && (match[8] != ""); 239 bool isUtc = (match[8] != null) && (match[8] != "");
240 int millisecondsSinceEpoch = _brokenDownDateToMillisecondsSinceEpoch( 240 int millisecondsSinceEpoch = _brokenDownDateToMillisecondsSinceEpoch(
241 years, month, day, hour, minute, second, millisecond, isUtc); 241 years, month, day, hour, minute, second, millisecond, isUtc);
242 if (millisecondsSinceEpoch == null) { 242 if (millisecondsSinceEpoch == null) {
243 throw new ArgumentError(formattedString); 243 throw new ArgumentError(formattedString);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 * Returns the millisecond into the second [0...999]. 507 * Returns the millisecond into the second [0...999].
508 */ 508 */
509 external int get millisecond; 509 external int get millisecond;
510 510
511 /** 511 /**
512 * Returns the week day [MON..SUN]. In accordance with ISO 8601 512 * Returns the week day [MON..SUN]. In accordance with ISO 8601
513 * a week starts with Monday which has the value 1. 513 * a week starts with Monday which has the value 1.
514 */ 514 */
515 external int get weekday; 515 external int get weekday;
516 } 516 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698