summaryrefslogtreecommitdiffstats
path: root/dive.h
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-10-10 18:14:55 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-10-11 15:13:39 +0900
commit94c98865a7a9de833e8ebb593d3db1058246e410 (patch)
treedcdbb6fccf8c6b4ea5183d2db9ee62783d56a55e /dive.h
parenta2afe4128082b603add2b2be83f97ff78e0d0169 (diff)
downloadsubsurface-94c98865a7a9de833e8ebb593d3db1058246e410.tar.gz
Improve on the DivingLog importer a bit
This adds a few fields that we parse, but more importantly it also tries to dynamically decide if the sample temperatures and pressures are in imperial or metric units. Dirk suspects that DivingLog generally always does everything in metric, and the reason why he has crazy sample data in imperial units (both for pressure and temperature) may be due to a bug in the early Uemis importer for DivingLog. Which would actually make a lot more sense than DivingLog really being so insane on purpose. Anyway, Dirk's brother Jurgen seems to have everything in metric units, which would be much saner. Maybe we should throw away the support for insane DivingLog files entirely, since it is possible that the only use ever of the possible source of that bug was Dirk's use of the Uemis importer. But for now, we end up just guessing. Current guesses: - water temperature is below 32 dgC, so 32+ degrees is in Fahrenheit. - tank pressures are below 400 bar, so higher values than that must be psi. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r--dive.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/dive.h b/dive.h
index 42c09b581..30218f84e 100644
--- a/dive.h
+++ b/dive.h
@@ -156,6 +156,11 @@ static inline unsigned long F_to_mkelvin(double f)
return (f-32) * 1000 / 1.8 + 273150.5;
}
+static inline unsigned long C_to_mkelvin(double c)
+{
+ return c * 1000 + 273150.5;
+}
+
static inline int to_C(temperature_t temp)
{
if (!temp.mkelvin)