| OLD | NEW |
| 1 part of dart.core; | 1 part of dart.core; |
| 2 | 2 class Stopwatch {int get frequency => _frequency; |
| 3 class Stopwatch { | 3 num _start; |
| 4 int get frequency => _frequency; | 4 num _stop; |
| 5 num _start; | 5 Stopwatch() { |
| 6 num _stop; | 6 _initTicker(); |
| 7 Stopwatch() { | |
| 8 _initTicker(); | |
| 9 } | 7 } |
| 10 void start() { | 8 void start() { |
| 11 if (isRunning) return; | 9 if (isRunning) return; if (_start == null) { |
| 12 if (_start == null) { | 10 _start = _now(); |
| 13 _start = _now(); | 11 } |
| 14 } else { | 12 else { |
| 15 _start = _now() - (_stop - _start); | 13 _start = _now() - (_stop - _start); |
| 16 _stop = null; | 14 _stop = null; |
| 17 } | 15 } |
| 18 } | 16 } |
| 19 void stop() { | 17 void stop() { |
| 20 if (!isRunning) return; | 18 if (!isRunning) return; _stop = _now(); |
| 21 _stop = _now(); | |
| 22 } | 19 } |
| 23 void reset() { | 20 void reset() { |
| 24 if (_start == null) return; | 21 if (_start == null) return; _start = _now(); |
| 25 _start = _now(); | 22 if (_stop != null) { |
| 26 if (_stop != null) { | 23 _stop = _start; |
| 27 _stop = _start; | |
| 28 } | 24 } |
| 29 } | 25 } |
| 30 int get elapsedTicks { | 26 int get elapsedTicks { |
| 31 if (_start == null) { | 27 if (_start == null) { |
| 32 return 0; | 28 return 0; |
| 33 } | 29 } |
| 34 return ((__x34) => DDC$RT.cast(__x34, num, int, "CastGeneral", | 30 return ((__x34) => DDC$RT.cast(__x34, num, int, "CastGeneral", """line 102, c
olumn 12 of dart:core/stopwatch.dart: """, __x34 is int, true))((_stop == null)
? (_now() - _start) : (_stop - _start)); |
| 35 """line 102, column 12 of dart:core/stopwatch.dart: """, __x34 is int, | |
| 36 true))((_stop == null) ? (_now() - _start) : (_stop - _start)); | |
| 37 } | 31 } |
| 38 Duration get elapsed { | 32 Duration get elapsed { |
| 39 return new Duration(microseconds: elapsedMicroseconds); | 33 return new Duration(microseconds: elapsedMicroseconds); |
| 40 } | 34 } |
| 41 int get elapsedMicroseconds { | 35 int get elapsedMicroseconds { |
| 42 return (elapsedTicks * 1000000) ~/ frequency; | 36 return (elapsedTicks * 1000000) ~/ frequency; |
| 43 } | 37 } |
| 44 int get elapsedMilliseconds { | 38 int get elapsedMilliseconds { |
| 45 return (elapsedTicks * 1000) ~/ frequency; | 39 return (elapsedTicks * 1000) ~/ frequency; |
| 46 } | 40 } |
| 47 bool get isRunning => _start != null && _stop == null; | 41 bool get isRunning => _start != null && _stop == null; |
| 48 static int _frequency; | 42 static int _frequency; |
| 49 static void _initTicker() { | 43 static void _initTicker() { |
| 50 Primitives.initTicker(); | 44 Primitives.initTicker(); |
| 51 _frequency = DDC$RT.cast(Primitives.timerFrequency, dynamic, int, | 45 _frequency = DDC$RT.cast(Primitives.timerFrequency, dynamic, int, "CastGenera
l", """line 143, column 18 of dart:core/stopwatch.dart: """, Primitives.timerFre
quency is int, true); |
| 52 "CastGeneral", """line 143, column 18 of dart:core/stopwatch.dart: """, | |
| 53 Primitives.timerFrequency is int, true); | |
| 54 } | 46 } |
| 55 static int _now() => ((__x35) => DDC$RT.cast(__x35, dynamic, int, | 47 static int _now() => ((__x35) => DDC$RT.cast(__x35, dynamic, int, "CastGeneral"
, """line 145, column 24 of dart:core/stopwatch.dart: """, __x35 is int, true))(
Primitives.timerTicks()); |
| 56 "CastGeneral", """line 145, column 24 of dart:core/stopwatch.dart: """, | |
| 57 __x35 is int, true))(Primitives.timerTicks()); | |
| 58 } | 48 } |
| OLD | NEW |