X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=parse-xml.c;h=e14d9db2b74ed0e7ac94ba9f2e6f30807d7d22ac;hb=0282d515db875cee0139e121db13084be0caac82;hp=8e64b1e21f35463aa19eb3393588bcc138b28478;hpb=27ed16072f3b49b07e0af495fed10f883de90c82;p=ext%2Fsubsurface.git diff --git a/parse-xml.c b/parse-xml.c index 8e64b1e..e14d9db 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -488,6 +488,16 @@ static int uemis_fill_sample(struct sample *sample, const char *name, int len, c * Divinglog is crazy. The temperatures are in celsius. EXCEPT * for the sample temperatures, that are in Fahrenheit. * WTF? + * + * Oh, and I think Diving Log *internally* probably kept them + * in celsius, because I'm seeing entries like + * + * 32.0 + * + * in there. Which is freezing, aka 0 degC. I bet the "0" is + * what Diving Log uses for "no temperature". + * + * So throw away crap like that. */ static void fahrenheit(char *buffer, void *_temperature) { @@ -496,6 +506,9 @@ static void fahrenheit(char *buffer, void *_temperature) switch (integer_or_float(buffer, &val)) { case FLOAT: + /* Floating point equality is evil, but works for small integers */ + if (val.fp == 32.0) + break; temperature->mkelvin = (val.fp + 459.67) * 5000/9; break; default: