| Index: corelib/src/implementation/stopwatch_implementation.dart
|
| diff --git a/corelib/src/implementation/stopwatch_implementation.dart b/corelib/src/implementation/stopwatch_implementation.dart
|
| index 231f4a8cd79a1d6d9c51abcc92a69e5f14834fab..e4c4115e3a3f94e0a62c1855bef98c2713c7b8f8 100644
|
| --- a/corelib/src/implementation/stopwatch_implementation.dart
|
| +++ b/corelib/src/implementation/stopwatch_implementation.dart
|
| @@ -3,17 +3,20 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| /**
|
| - * A simple implementation of the [StopWatch] interface.
|
| + * A simple implementation of the [Stopwatch] interface.
|
| */
|
| -class StopWatchImplementation implements StopWatch {
|
| +class StopwatchImplementation implements Stopwatch {
|
| // The _start and _stop fields capture the time when [start] and [stop]
|
| // are called respectively.
|
| - // If _start is null, then the [StopWatch] has not been started yet.
|
| - // If _stop is null, then the [StopWatch] has not been stopped yet.
|
| + // If _start is null, then the [Stopwatch] has not been started yet.
|
| + // If _stop is null, then the [Stopwatch] has not been stopped yet.
|
| int _start;
|
| int _stop;
|
|
|
| - StopWatchImplementation() : _start = null, _stop = null {}
|
| + StopwatchImplementation() : _start = null, _stop = null {}
|
| + StopwatchImplementation.start() : _start = null, _stop = null {
|
| + start();
|
| + }
|
|
|
| void start() {
|
| if (_start === null) {
|
| @@ -36,6 +39,14 @@ class StopWatchImplementation implements StopWatch {
|
| _stop = Clock.now();
|
| }
|
|
|
| + void reset() {
|
| + if (_start === null) return;
|
| + _start = Clock.now();
|
| + if (_stop !== null) {
|
| + _stop = _start;
|
| + }
|
| + }
|
| +
|
| int elapsed() {
|
| if (_start === null) {
|
| return 0;
|
|
|