Chromium Code Reviews| Index: sdk/lib/core/duration.dart |
| diff --git a/sdk/lib/core/duration.dart b/sdk/lib/core/duration.dart |
| index d68c9e73789cfd6df13426a583a5d07d74bbb9eb..015484053b66e53cb405b37339a68721ad08f2dd 100644 |
| --- a/sdk/lib/core/duration.dart |
| +++ b/sdk/lib/core/duration.dart |
| @@ -50,6 +50,39 @@ class Duration implements Comparable { |
| milliseconds; |
| /** |
| + * Returns the sum of this [Duration] and [other] as a new [Duration]. |
| + */ |
| + Duration operator +(Duration other) { |
| + return new Duration(milliseconds: inMilliseconds + other.inMilliseconds); |
| + } |
| + |
| + /** |
| + * Returns the difference of this [Duration] and [other] as a new |
| + * [Duration]. |
| + */ |
| + Duration operator -(Duration other) { |
| + return new Duration(milliseconds: inMilliseconds - other.inMilliseconds); |
| + } |
| + |
| + /** |
| + * Multiplies this [Duration] by the given [factor] and returns the result |
| + * as a new [Duration]. |
| + */ |
| + Duration operator *(int factor) { |
| + return new Duration(milliseconds: inMilliseconds * factor); |
| + } |
|
Lasse Reichstein Nielsen
2013/02/09 01:13:30
Consider having ~/ too.
floitsch
2013/02/09 02:08:04
Done.
|
| + |
| + bool operator <(Duration other) => this.inMilliseconds < other.inMilliseconds; |
| + |
| + bool operator >(Duration other) => this.inMilliseconds > other.inMilliseconds; |
| + |
| + bool operator <=(Duration other) => |
| + this.inMilliseconds <= other.inMilliseconds; |
| + |
| + bool operator >=(Duration other) => |
| + this.inMilliseconds >= other.inMilliseconds; |
| + |
| + /** |
| * This [Duration] in days. Incomplete days are discarded |
| */ |
| int get inDays { |