summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/dive.c b/dive.c
index 57a735c8e..a420a3ef6 100644
--- a/dive.c
+++ b/dive.c
@@ -120,6 +120,28 @@ double get_depth_units(unsigned int mm, int *frac, const char **units)
return d;
}
+double get_weight_units(unsigned int grams, int *frac, const char **units)
+{
+ int decimals;
+ double value;
+ const char* unit;
+
+ if (output_units.weight == LBS) {
+ value = grams_to_lbs(grams);
+ unit = "lbs";
+ decimals = 0;
+ } else {
+ value = grams / 1000.0;
+ unit = "kg";
+ decimals = 1;
+ }
+ if (frac)
+ *frac = decimals;
+ if (units)
+ *units = unit;
+ return value;
+}
+
struct dive *alloc_dive(void)
{
const int initial_samples = 5;