diff --git a/multigrid/src/main.rs b/multigrid/src/main.rs index 99d33eb..fe748aa 100644 --- a/multigrid/src/main.rs +++ b/multigrid/src/main.rs @@ -115,15 +115,12 @@ fn main() { let mut itime = 0; while itime < ntime { - sys.advance(steps_between_outputs); + let nexttime = (itime + steps_between_outputs).max(ntime); + sys.advance(nexttime - itime); - itime += steps_between_outputs; + itime = nexttime; sys.output(itime); } - if itime != ntime { - sys.advance(ntime - itime); - sys.output(ntime); - } if !opt.no_progressbar { sys.finish_progressbar();