diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-03-11 08:41:41 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-03-11 08:41:41 -0800 |
commit | 08284275e733fcea8b909b86fda503d4b24e0b84 (patch) | |
tree | b2092172f09044d58efdae479447bae9b6c824ad /core/divelist.c | |
parent | b8b858a9d299877969527ef5b3c4bde97bb86d05 (diff) | |
parent | 2b06a0b2234cf2779f80e87038011067be282bcb (diff) | |
download | subsurface-08284275e733fcea8b909b86fda503d4b24e0b84.tar.gz |
Merge branch 'master' of https://github.com/dje29/subsurface
Diffstat (limited to 'core/divelist.c')
-rw-r--r-- | core/divelist.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/divelist.c b/core/divelist.c index 44401b7c0..f3465830e 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -178,12 +178,12 @@ static int calculate_otu(struct dive *dive) po2 = sample->setpoint.mbar; } else { int o2 = active_o2(dive, dc, sample->time); - po2 = o2 * depth_to_atm(sample->depth.mm, dive); + po2 = lrint(o2 * depth_to_atm(sample->depth.mm, dive)); } if (po2 >= 500) otu += pow((po2 - 500) / 1000.0, 0.83) * t / 30.0; } - return rint(otu); + return lrint(otu); } /* calculate CNS for a dive - this only takes the first divecomputer into account */ int const cns_table[][3] = { @@ -243,7 +243,7 @@ static int calculate_cns(struct dive *dive) po2 = sample->setpoint.mbar; } else { int o2 = active_o2(dive, dc, sample->time); - po2 = o2 * depth_to_atm(sample->depth.mm, dive); + po2 = lrint(o2 * depth_to_atm(sample->depth.mm, dive)); } /* CNS don't increse when below 500 matm */ if (po2 < 500) @@ -256,7 +256,7 @@ static int calculate_cns(struct dive *dive) cns += ((double)t) / ((double)cns_table[j][1]) * 100; } /* save calculated cns in dive struct */ - dive->cns = cns; + dive->cns = lrint(cns); return dive->cns; } /* @@ -305,7 +305,7 @@ static int calculate_sac(struct dive *dive) sac = airuse / pressure * 60 / duration; /* milliliters per minute.. */ - return sac * 1000; + return lrint(sac * 1000); } /* for now we do this based on the first divecomputer */ |