OLD | NEW |
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 span of time, such as 27 days, 4 hours, 12 minutes, and 3 seconds. | 8 * A span of time, such as 27 days, 4 hours, 12 minutes, and 3 seconds. |
9 * | 9 * |
10 * A `Duration` represents a difference from one point in time to another. The | 10 * A `Duration` represents a difference from one point in time to another. The |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 * positive. | 288 * positive. |
289 */ | 289 */ |
290 Duration abs() => new Duration._microseconds(_duration.abs()); | 290 Duration abs() => new Duration._microseconds(_duration.abs()); |
291 | 291 |
292 /** | 292 /** |
293 * Returns a new `Duration` representing this `Duration` negated. | 293 * Returns a new `Duration` representing this `Duration` negated. |
294 * | 294 * |
295 * The returned `Duration` has the same length as this one, but will have the | 295 * The returned `Duration` has the same length as this one, but will have the |
296 * opposite sign of this one. | 296 * opposite sign of this one. |
297 */ | 297 */ |
298 Duration operator -() => new Duration._microseconds(-_duration); | 298 // Using subtraction helps dart2js avoid negative zeros. |
| 299 Duration operator -() => new Duration._microseconds(0 - _duration); |
299 } | 300 } |
OLD | NEW |