*/
public void tick(int millisToAdvance) {
currentTime += millisToAdvance;
while (!tasks.isEmpty() && tasks.peek().getTime() <= currentTime) {
TimedTask timedTask = tasks.poll();
IncrementalTask task = timedTask.getTask();
boolean doReschedule = task.execute();
if (doReschedule) {
// Note: If the next execution is at or before currentTime, the task
// will be re-executed before this tick() call returns.
tasks.add(timedTask.nextExecution());
}