diff options
author | pacien | 2018-02-04 19:31:43 +0100 |
---|---|---|
committer | pacien | 2018-02-04 19:31:43 +0100 |
commit | e7d7b2302cd836f4a9ddbde6fd3e71e7f14c0e9d (patch) | |
tree | 3ff92498c1291fc859c441e813919b0003fde7b1 | |
parent | b5384f19db2e6211a3c8832b9dfcdca077873a39 (diff) | |
download | wallj-e7d7b2302cd836f4a9ddbde6fd3e71e7f14c0e9d.tar.gz |
Fix exec duration timing
Signed-off-by: pacien <pacien.trangirard@pacien.net>
-rw-r--r-- | src/main/java/fr/umlv/java/wallj/viewer/Viewer.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/fr/umlv/java/wallj/viewer/Viewer.java b/src/main/java/fr/umlv/java/wallj/viewer/Viewer.java index 6b4f5c4..5a7d869 100644 --- a/src/main/java/fr/umlv/java/wallj/viewer/Viewer.java +++ b/src/main/java/fr/umlv/java/wallj/viewer/Viewer.java | |||
@@ -47,12 +47,13 @@ public final class Viewer { | |||
47 | events.clear(); | 47 | events.clear(); |
48 | events.addAll(newEvents); //add the new events returned by updates | 48 | events.addAll(newEvents); //add the new events returned by updates |
49 | }); | 49 | }); |
50 | lastExecDuration = FRAME_DURATION.minus(stopWatch.peek()); | ||
51 | try { | 50 | try { |
52 | if (!lastExecDuration.isNegative()) Thread.sleep(lastExecDuration.toMillis()); | 51 | Duration sleepDuration = FRAME_DURATION.minus(stopWatch.peek()); |
52 | if (!sleepDuration.isNegative()) Thread.sleep(sleepDuration.toMillis()); | ||
53 | } catch (Exception e) { | 53 | } catch (Exception e) { |
54 | applicationContext.exit(-1); | 54 | applicationContext.exit(-1); |
55 | } | 55 | } |
56 | lastExecDuration = stopWatch.peek(); | ||
56 | } | 57 | } |
57 | applicationContext.exit(0); | 58 | applicationContext.exit(0); |
58 | } | 59 | } |