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 simple [Stopwatch] interface to measure elapsed time. | 8 * A simple stopwatch interface to measure elapsed time. |
9 */ | 9 */ |
10 class Stopwatch { | 10 class Stopwatch { |
11 // The _start and _stop fields capture the time when [start] and [stop] | 11 // The _start and _stop fields capture the time when [start] and [stop] |
12 // are called respectively. | 12 // are called respectively. |
13 // If _start is null, then the [Stopwatch] has not been started yet. | 13 // If _start is null, then the [Stopwatch] has not been started yet. |
14 // If _stop is null, then the [Stopwatch] has not been stopped yet, | 14 // If _stop is null, then the [Stopwatch] has not been stopped yet, |
15 // or is running. | 15 // or is running. |
16 int _start; | 16 int _start; |
17 int _stop; | 17 int _stop; |
18 | 18 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 int get frequency => _frequency(); | 122 int get frequency => _frequency(); |
123 | 123 |
124 /** | 124 /** |
125 * Returns wether the [StopWatch] is currently running. | 125 * Returns wether the [StopWatch] is currently running. |
126 */ | 126 */ |
127 bool get isRunning => _start != null && _stop == null; | 127 bool get isRunning => _start != null && _stop == null; |
128 | 128 |
129 external static int _frequency(); | 129 external static int _frequency(); |
130 external static int _now(); | 130 external static int _now(); |
131 } | 131 } |
OLD | NEW |