| Index: corelib/unified/coreimpl/stopwatch.dart
|
| diff --git a/corelib/src/implementation/stopwatch_implementation.dart b/corelib/unified/coreimpl/stopwatch.dart
|
| similarity index 76%
|
| copy from corelib/src/implementation/stopwatch_implementation.dart
|
| copy to corelib/unified/coreimpl/stopwatch.dart
|
| index 1316a27fd9573d051e20c49993e779ba244b898c..581ca561f41661aa32412bb91a9b7fa87e1e9fc6 100644
|
| --- a/corelib/src/implementation/stopwatch_implementation.dart
|
| +++ b/corelib/unified/coreimpl/stopwatch.dart
|
| @@ -22,14 +22,14 @@ class StopwatchImplementation implements Stopwatch {
|
| void start() {
|
| if (_start === null) {
|
| // This stopwatch has never been started.
|
| - _start = Clock.now();
|
| + _start = _Clock.now();
|
| } else {
|
| if (_stop === null) {
|
| return;
|
| }
|
| // Restarting this stopwatch. Prepend the elapsed time to the current
|
| // start time.
|
| - _start = Clock.now() - (_stop - _start);
|
| + _start = _Clock.now() - (_stop - _start);
|
| _stop = null;
|
| }
|
| }
|
| @@ -38,14 +38,14 @@ class StopwatchImplementation implements Stopwatch {
|
| if (_start === null || _stop !== null) {
|
| return;
|
| }
|
| - _stop = Clock.now();
|
| + _stop = _Clock.now();
|
| }
|
|
|
| void reset() {
|
| if (_start === null) return;
|
| // If [_start] is not null, then the stopwatch had already been started. It
|
| // may running right now.
|
| - _start = Clock.now();
|
| + _start = _Clock.now();
|
| if (_stop !== null) {
|
| // The watch is not running. So simply set the [_stop] to [_start] thus
|
| // having an elapsed time of 0.
|
| @@ -57,7 +57,7 @@ class StopwatchImplementation implements Stopwatch {
|
| if (_start === null) {
|
| return 0;
|
| }
|
| - return (_stop === null) ? (Clock.now() - _start) : (_stop - _start);
|
| + return (_stop === null) ? (_Clock.now() - _start) : (_stop - _start);
|
| }
|
|
|
| int elapsedInUs() {
|
| @@ -69,7 +69,23 @@ class StopwatchImplementation implements Stopwatch {
|
| }
|
|
|
| int frequency() {
|
| - return Clock.frequency();
|
| + return _Clock.frequency();
|
| }
|
| +}
|
| +
|
| +/**
|
| + * The class [_Clock] provides access to a monotonically incrementing clock
|
| + * device.
|
| + */
|
| +class _Clock {
|
| +
|
| + /**
|
| + * Returns the current clock tick.
|
| + */
|
| + external static int now();
|
|
|
| + /**
|
| + * Returns the frequency of clock ticks in Hz.
|
| + */
|
| + external static int frequency();
|
| }
|
|
|