summaryrefslogtreecommitdiffstats
path: root/statistics.c
diff options
context:
space:
mode:
Diffstat (limited to 'statistics.c')
-rw-r--r--statistics.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/statistics.c b/statistics.c
index a60c6e404..d7f8371fa 100644
--- a/statistics.c
+++ b/statistics.c
@@ -28,8 +28,6 @@ stats_t stats_selection;
stats_t *stats_monthly = NULL;
stats_t *stats_yearly = NULL;
-
-
static void process_temperatures(struct dive *dp, stats_t *stats)
{
int min_temp, mean_temp, max_temp = 0;
@@ -275,3 +273,19 @@ void get_selected_dives_text(char *buffer, int size)
}
}
}
+
+volume_t get_gas_used(struct dive *dive)
+{
+ int idx;
+ volume_t gas_used = { 0 };
+ for (idx = 0; idx < MAX_CYLINDERS; idx++) {
+ cylinder_t *cyl = &dive->cylinder[idx];
+ pressure_t start, end;
+
+ start = cyl->start.mbar ? cyl->start : cyl->sample_start;
+ end = cyl->end.mbar ?cyl->sample_end : cyl->sample_end;
+ if (start.mbar && end.mbar)
+ gas_used.mliter += gas_volume(cyl, start) - gas_volume(cyl, end);
+ }
+ return gas_used;
+}