- // always execute to keep timeline from "hanging behind" for too long
- long current = tf.getAsLong();
- timeline.executeUntil(timeline.laterThan(current), System.currentTimeMillis() + 10);
+ long current = tf.getTime();
+ // The tf.isPaused() condition is justified, because timeline.getSimulationTime() returns the timestamp of the last
+ // processed event during executeUntil()
+ if (timeline.executeUntil(() -> timeline.laterThan(current).getAsBoolean() || tf.isPaused(),
+ System.currentTimeMillis() + 10) == ExecutionResult.EXEC_OUT_OF_TIME)
+ timeline.synchTime(); // TODO: should this also be called if tf.isPaused() condition is met?