diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2016-01-10 12:12:39 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-10 14:13:58 -0800 |
commit | 7701975d9804f9ce1f62a10a1a2d890f7c1b82d1 (patch) | |
tree | db43000c7dda553edc671e9c335418e517867e10 /subsurface-core/save-html.c | |
parent | 82c87204e48654a9b2661c68fe66b9f16f81c4ba (diff) | |
download | subsurface-7701975d9804f9ce1f62a10a1a2d890f7c1b82d1.tar.gz |
Support for imperial depth on worldmap export
This will use the depth units from user preferences when exporting the
worldmap.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/save-html.c')
-rw-r--r-- | subsurface-core/save-html.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/subsurface-core/save-html.c b/subsurface-core/save-html.c index 64ce94f66..5fc5b000a 100644 --- a/subsurface-core/save-html.c +++ b/subsurface-core/save-html.c @@ -259,6 +259,29 @@ void put_HTML_time(struct membuffer *b, struct dive *dive, const char *pre, cons put_format(b, "%s%02u:%02u:%02u%s", pre, tm.tm_hour, tm.tm_min, tm.tm_sec, post); } +void put_HTML_depth(struct membuffer *b, struct dive *dive, const char *pre, const char *post) +{ + const char *unit; + double value; + struct units *units_p = get_units(); + + if (!dive->maxdepth.mm) { + put_format(b, "%s--%s", pre, post); + return; + } + value = get_depth_units(dive->maxdepth.mm, NULL, &unit); + + switch (units_p->length) { + case METERS: + default: + put_format(b, "%s%.1f %s%s", pre, value, unit, post); + break; + case FEET: + put_format(b, "%s%.0f %s%s", pre, value, unit, post); + break; + } +} + void put_HTML_airtemp(struct membuffer *b, struct dive *dive, const char *pre, const char *post) { const char *unit; |