summaryrefslogtreecommitdiff
path: root/opendc-common/src
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2023-11-15 15:56:03 +0100
committerGitHub <noreply@github.com>2023-11-15 15:56:03 +0100
commit05141e92582372c816648b94ef3de5e16d1fe5b9 (patch)
tree41e703d5a129948d445d9957392c632ab3f74872 /opendc-common/src
parent2fc71b81ea01072c37ce140d4a47e33a25d65f72 (diff)
parent1513efe07605975cd2f86f0b739bd490e4fc9970 (diff)
Merge pull request #168 from DanteNiewenhuis/greenifier-demo
Updated the simulation to let servers run until they are finished.
Diffstat (limited to 'opendc-common/src')
-rw-r--r--opendc-common/src/main/java/org/opendc/common/util/Pacer.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/opendc-common/src/main/java/org/opendc/common/util/Pacer.java b/opendc-common/src/main/java/org/opendc/common/util/Pacer.java
index 5b8d8cb0..f3b9a8a7 100644
--- a/opendc-common/src/main/java/org/opendc/common/util/Pacer.java
+++ b/opendc-common/src/main/java/org/opendc/common/util/Pacer.java
@@ -73,7 +73,7 @@ public final class Pacer {
// We assume that the scheduler runs at a fixed slot every time quantum (e.g t=0, t=60, t=120).
// We calculate here the delay until the next scheduling slot.
- long timeUntilNextSlot = quantumMs - (now % quantumMs);
+ long timeUntilNextSlot = (quantumMs - (now % quantumMs)) % quantumMs;
handle = dispatcher.scheduleCancellable(timeUntilNextSlot, () -> {
process.accept(now + timeUntilNextSlot);