mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
Planner: Don't accumulate rounding errors in stop durations
When displaying segment or stop times in the planner notes, we always round to the next full minute. This can mean for example that we round down more often than rounding up with the result that the sum of the segment times does not match the total runtime and can for example lead to stops that are shown with 0min duration. With this patch, we increase the reference time of the last display only by the duration time actually shown. This way, the rounding errors don't accumulate but having rounded down previously makes rounding up the next time more propable. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
f1e7adfedc
commit
a3a3913e1e
2 changed files with 3 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
Planner: Add checkbox on considering oxygen narcotic
|
||||
Planner: Improve rounding of stop durations in planner notes
|
||||
Desktop: register changes when clicking "done" on dive-site edit screen
|
||||
Mobile: re-enable GPS location service icon in global drawer
|
||||
Mobile: add support for editing the dive number of a dive
|
||||
|
|
|
@ -375,7 +375,8 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
|||
}
|
||||
put_string(&buf, "</tr>\n");
|
||||
newdepth = dp->depth.mm;
|
||||
lasttime = dp->time;
|
||||
// Only add the time we actually displayed so rounding errors dont accumulate
|
||||
lasttime += ((dp->time - lasttime + 30) / 60) * 60;
|
||||
}
|
||||
}
|
||||
if (gaschange_after || gaschange_before) {
|
||||
|
|
Loading…
Add table
Reference in a new issue