| 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 /** | 5 /** |
| 6 * A simple [Stopwatch] interface to measure elapsed time. | 6 * A simple [Stopwatch] interface to measure elapsed time. |
| 7 */ | 7 */ |
| 8 interface Stopwatch default StopwatchImplementation { | 8 abstract class Stopwatch { |
| 9 | |
| 10 /** | 9 /** |
| 11 * Creates a [Stopwatch] in stopped state with a zero elapsed count. | 10 * Creates a [Stopwatch] in stopped state with a zero elapsed count. |
| 12 * | 11 * |
| 13 * The following example shows how to start a [Stopwatch] | 12 * The following example shows how to start a [Stopwatch] |
| 14 * right after allocation. | 13 * right after allocation. |
| 15 * | 14 * |
| 16 * Stopwatch stopwatch = new Stopwatch()..start(); | 15 * Stopwatch stopwatch = new Stopwatch()..start(); |
| 17 */ | 16 */ |
| 18 Stopwatch(); | 17 factory Stopwatch() => new StopwatchImplementation(); |
| 19 | 18 |
| 20 /** | 19 /** |
| 21 * Starts the [Stopwatch]. The [elapsed] count is increasing monotonically. | 20 * Starts the [Stopwatch]. The [elapsed] count is increasing monotonically. |
| 22 * If the [Stopwatch] has been stopped, then calling start again restarts it | 21 * If the [Stopwatch] has been stopped, then calling start again restarts it |
| 23 * without resetting the [elapsed] count. | 22 * without resetting the [elapsed] count. |
| 24 * If the [Stopwatch] is currently running, then calling start does nothing. | 23 * If the [Stopwatch] is currently running, then calling start does nothing. |
| 25 */ | 24 */ |
| 26 void start(); | 25 void start(); |
| 27 | 26 |
| 28 /** | 27 /** |
| (...skipping 28 matching lines...) Expand all Loading... |
| 57 * Returns the [elapsed] counter converted to milliseconds. | 56 * Returns the [elapsed] counter converted to milliseconds. |
| 58 */ | 57 */ |
| 59 int elapsedInMs(); | 58 int elapsedInMs(); |
| 60 | 59 |
| 61 /** | 60 /** |
| 62 * Returns the frequency of the elapsed counter in Hz. | 61 * Returns the frequency of the elapsed counter in Hz. |
| 63 */ | 62 */ |
| 64 int frequency(); | 63 int frequency(); |
| 65 | 64 |
| 66 } | 65 } |
| OLD | NEW |