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

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

Issue 11748016: Make ~/, round, ceil, floor, truncate return ints. Remove toInt. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Checked mode fixes. Created 7 years, 11 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 * Date is the public interface to a point in time. 8 * Date is the public interface to 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 return double.parse(matched); 274 return double.parse(matched);
275 } 275 }
276 276
277 int years = int.parse(match[1]); 277 int years = int.parse(match[1]);
278 int month = int.parse(match[2]); 278 int month = int.parse(match[2]);
279 int day = int.parse(match[3]); 279 int day = int.parse(match[3]);
280 int hour = parseIntOrZero(match[4]); 280 int hour = parseIntOrZero(match[4]);
281 int minute = parseIntOrZero(match[5]); 281 int minute = parseIntOrZero(match[5]);
282 int second = parseIntOrZero(match[6]); 282 int second = parseIntOrZero(match[6]);
283 bool addOneMillisecond = false; 283 bool addOneMillisecond = false;
284 int millisecond = (parseDoubleOrZero(match[7]) * 1000).round().toInt(); 284 int millisecond = (parseDoubleOrZero(match[7]) * 1000).round();
285 if (millisecond == 1000) { 285 if (millisecond == 1000) {
286 addOneMillisecond = true; 286 addOneMillisecond = true;
287 millisecond = 999; 287 millisecond = 999;
288 } 288 }
289 // TODO(floitsch): we should not need to test against the empty string. 289 // TODO(floitsch): we should not need to test against the empty string.
290 bool isUtc = (match[8] != null) && (match[8] != ""); 290 bool isUtc = (match[8] != null) && (match[8] != "");
291 int millisecondsSinceEpoch = _brokenDownDateToMillisecondsSinceEpoch( 291 int millisecondsSinceEpoch = _brokenDownDateToMillisecondsSinceEpoch(
292 years, month, day, hour, minute, second, millisecond, isUtc); 292 years, month, day, hour, minute, second, millisecond, isUtc);
293 if (millisecondsSinceEpoch == null) { 293 if (millisecondsSinceEpoch == null) {
294 throw new ArgumentError(formattedString); 294 throw new ArgumentError(formattedString);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 external Duration get timeZoneOffset; 419 external Duration get timeZoneOffset;
420 external int get year; 420 external int get year;
421 external int get month; 421 external int get month;
422 external int get day; 422 external int get day;
423 external int get hour; 423 external int get hour;
424 external int get minute; 424 external int get minute;
425 external int get second; 425 external int get second;
426 external int get millisecond; 426 external int get millisecond;
427 external int get weekday; 427 external int get weekday;
428 } 428 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698