case FLOAT:
/* Maybe it's in Bar? */
if (val.fp < 500.0) {
- pressure->mbar = val.fp * 1000;
+ pressure->mbar = val.fp * 1000 + 0.5;
break;
}
printf("Unknown fractional pressure reading %s\n", buffer);
val.fp = val.i;
/* fallthrough */
case FLOAT:
- depth->mm = val.fp * 1000;
+ depth->mm = val.fp * 1000 + 0.5;
break;
default:
printf("Strange depth reading %s\n", buffer);
break;
/* Celsius */
if (val.fp < 50.0) {
- temperature->mkelvin = (val.fp + 273.16) * 1000;
+ temperature->mkelvin = (val.fp + 273.15) * 1000 + 0.5;
break;
}
/* Fahrenheit */
return;
if (MATCH(".sample.depth", depth, &sample->depth))
return;
+ if (MATCH(".sample.temp", temperature, &sample->temperature))
+ return;
if (MATCH(".sample.temperature", temperature, &sample->temperature))
return;
if (MATCH(".sample.sampletime", sampletime, &sample->time))
{
fprintf(f, " <maxdepth>%u.%03u m</maxdepth>\n", FRACTION(dive->maxdepth.mm, 1000));
show_temperature(f, dive->airtemp, " <airtemp>", " C</airtemp>\n");
+ show_temperature(f, dive->watertemp, " <watertemp>", " C</airtemp>\n");
}
static void save_gasmix(FILE *f, struct dive *dive)
FRACTION(sample->depth.mm, 1000));
show_temperature(f, sample->temperature, " temp='", " C'");
if (sample->tankpressure.mbar) {
- fprintf(f, " tankpressure='%u.%03u bar'",
+ fprintf(f, " pressure='%u.%03u bar'",
FRACTION(sample->tankpressure.mbar, 1000));
}
fprintf(f, "></sample>\n");