summaryrefslogtreecommitdiff
path: root/opendc-core/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-core/src/main')
-rw-r--r--opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/omega/OmegaSimulator.kt10
1 files changed, 6 insertions, 4 deletions
diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/omega/OmegaSimulator.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/omega/OmegaSimulator.kt
index 6b7407e5..764134e5 100644
--- a/opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/omega/OmegaSimulator.kt
+++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/omega/OmegaSimulator.kt
@@ -121,13 +121,15 @@ class OmegaSimulator(override val topology: Topology): Simulator, Iterator<Unit>
while (true) {
val (tick, block) = clock.queue.peek() ?: return
- if (tick > clock.tick)
+ if (tick > clock.tick) {
// Tick has yet to occur
+ // Jump in time to next event
+ clock.tick = tick - 1
break
- else if (tick < clock.tick)
+ } else if (tick < clock.tick) {
// Tick has already occurred
- logger.warn {"tick was not handled correctly"}
-
+ logger.warn { "tick was not handled correctly" }
+ }
clock.queue.poll()
block()
}