Chromium Code Reviews| Index: sdk/lib/core/stopwatch.dart |
| =================================================================== |
| --- sdk/lib/core/stopwatch.dart (revision 32577) |
| +++ sdk/lib/core/stopwatch.dart (working copy) |
| @@ -8,6 +8,11 @@ |
| * A simple stopwatch interface to measure elapsed time. |
| */ |
| class Stopwatch { |
| + /** |
| + * Frequency of the elapsed counter in Hz. |
| + */ |
| + int frequency; |
|
kasperl
2014/02/12 07:43:26
This needs to be final. Otherwise, you're in troub
kasperl
2014/02/12 07:44:16
You can also initialize this at the declaration si
siva
2014/02/13 01:16:50
Good catch, need to get used to Dart programming.
siva
2014/02/13 01:16:50
Done.
|
| + |
| // 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. |
| @@ -24,7 +29,7 @@ |
| * |
| * Stopwatch stopwatch = new Stopwatch()..start(); |
| */ |
| - Stopwatch() : _start = null, _stop = null {} |
| + Stopwatch() : _start = null, _stop = null, frequency = _frequency() {} |
| /** |
| * Starts the [Stopwatch]. |
| @@ -116,10 +121,6 @@ |
| return (elapsedTicks * 1000) ~/ frequency; |
| } |
| - /** |
| - * Returns the frequency of the elapsed counter in Hz. |
| - */ |
| - int get frequency => _frequency(); |
| /** |
| * Returns wether the [StopWatch] is currently running. |