Index: tests/isolate/timer_isolate_test.dart |
diff --git a/tests/isolate/timer_isolate_test.dart b/tests/isolate/timer_isolate_test.dart |
index 7513dadc1caa12630e15129c831500436bd55908..cb8fcbbfadc3290f5f2aff83503a5a738e06caad 100644 |
--- a/tests/isolate/timer_isolate_test.dart |
+++ b/tests/isolate/timer_isolate_test.dart |
@@ -23,18 +23,16 @@ createTimer(replyTo) { |
main() { |
test("timer in isolate", () { |
- int startTime; |
- int endTime; |
- |
+ Stopwatch stopwatch = new Stopwatch(); |
ReceivePort port = new ReceivePort(); |
port.first.then(expectAsync((msg) { |
expect("timer_fired", msg); |
- int endTime = (new DateTime.now()).millisecondsSinceEpoch; |
- expect(endTime - startTime + safetyMargin, greaterThanOrEqualTo(TIMEOUT.inMilliseconds)); |
+ expect(stopwatch.elapsedMilliseconds + safetyMargin, |
+ greaterThanOrEqualTo(TIMEOUT.inMilliseconds)); |
})); |
- startTime = (new DateTime.now()).millisecondsSinceEpoch; |
+ stopwatch.start(); |
var remote = Isolate.spawn(createTimer, port.sendPort); |
}); |
} |