summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/dive.c b/dive.c
index f5d082801..f4bf497a7 100644
--- a/dive.c
+++ b/dive.c
@@ -473,7 +473,12 @@ struct dive *fixup_dive(struct dive *dive)
}
}
if (end < 0)
+ {
+ /* Assume an ascent/descent rate of 9 m/min */
+ int asc_desc_time = dive->maxdepth.mm*60/9000;
+ dive->meandepth.mm = dive->maxdepth.mm*(dive->duration.seconds-asc_desc_time)/dive->duration.seconds;
return dive;
+ }
update_duration(&dive->duration, end - start);
if (start != end)