Skip to content

Commit

Permalink
[sre] Use the new functions of Time capacity for implementing the tim…
Browse files Browse the repository at this point in the history
…e supports into the Schedules BIC.

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Oct 9, 2018
1 parent bec4f38 commit b85cbe7
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -236,7 +236,7 @@ public AgentTask in(AgentTask task, long delay, Procedure1<? super Agent> proced
synchronized (getTaskListMutex()) {
pair = preRunTask(task, procedure);
}
final long osDelay = Math.round(getTimeSkill().getOSTimeFactor() * delay);
final long osDelay = Math.round(getTimeSkill().toOSDuration(delay));
final AgentTask runnableTask = pair != null ? pair.getTask() : task;
final ScheduledFuture<?> sf = this.executorService.schedule(
new AgentTaskRunner(runnableTask, false),
Expand Down Expand Up @@ -414,7 +414,7 @@ public AgentTask every(AgentTask task, long period, Procedure1<? super Agent> pr
synchronized (getTaskListMutex()) {
description = preRunTask(task, procedure);
}
final long osPeriod = Math.round(getTimeSkill().getOSTimeFactor() * period);
final long osPeriod = Math.round(getTimeSkill().toOSDuration(period));
final AgentTask runnableTask = description != null ? description.getTask() : task;
final ScheduledFuture<?> sf = this.executorService.scheduleAtFixedRate(
new AgentTaskRunner(runnableTask, true),
Expand All @@ -438,7 +438,7 @@ public AgentTask atFixedDelay(AgentTask task, long delay, Procedure1<? super Age
}
final AgentTask runnableTask = description != null ? description.getTask() : task;
final Future<?> future;
final long osDelay = Math.round(getTimeSkill().getOSTimeFactor() * delay);
final long osDelay = Math.round(getTimeSkill().toOSDuration(delay));
if (osDelay <= 0) {
future = this.executorService.submit(new AgentInfiniteLoopTask(runnableTask));
} else {
Expand Down

0 comments on commit b85cbe7

Please sign in to comment.