diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-08-07 11:24:40 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-08-07 11:24:40 -0700 |
commit | 19621bf481c68955184c11dd407c59af4a05130e (patch) | |
tree | f1823ba7b8db3f431ffd71ead37a4d9f46c7a9c4 /dive.c | |
parent | 39f606350b6025cb7c5cf9e657d7ef092eb026d7 (diff) | |
download | subsurface-19621bf481c68955184c11dd407c59af4a05130e.tar.gz |
Add total weight column to divelist
This adds the total weight carried on the dive in different weight systems
to the divelist. The column is by default not shown, which can be changed
in the preferences. The column is sortable.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r-- | dive.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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; |