summaryrefslogtreecommitdiffstats
path: root/libdivecomputer.c
diff options
context:
space:
mode:
authorGravatar Patrick Valsecchi <patrick@thus.ch>2013-10-08 09:07:43 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-08 06:16:06 -0700
commita13992a44b6b4e6d36623e1e7d0cd0b94d284d34 (patch)
tree6d16d1eda87e075179f4db191faa7228f6adbfb6 /libdivecomputer.c
parent7180c708e9cd8de3ebb5e281fe2709a027624cee (diff)
downloadsubsurface-a13992a44b6b4e6d36623e1e7d0cd0b94d284d34.tar.gz
Fixed conversion error when downloading salinity from DC
libdivecomputer doesn't give the salinity in kg/l, but in g/l and subsurface works with g/10l. So the salinity was too big by a factor of 1000. Signed-off-by: Patrick Valsecchi <patrick@thus.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r--libdivecomputer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c
index 0569689ec..9f4500d03 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -453,7 +453,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
// Check if the libdivecomputer version already supports salinity & atmospheric
dc_salinity_t salinity = {
.type = DC_WATER_SALT,
- .density = 1.03
+ .density = SEAWATER_SALINITY/10.0
};
rc = dc_parser_get_field(parser, DC_FIELD_SALINITY, 0, &salinity);
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
@@ -461,7 +461,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
dc_parser_destroy(parser);
return rc;
}
- dive->dc.salinity = salinity.density * 10000.0 + 0.5;
+ dive->dc.salinity = salinity.density * 10.0 + 0.5;
double surface_pressure = 1.0;
rc = dc_parser_get_field(parser, DC_FIELD_ATMOSPHERIC, 0, &surface_pressure);