Import from JDiveLog misses deco ceiling

Dirk Hohndel dirk at hohndel.org
Fri Dec 14 09:51:18 PST 2012


Linus Torvalds <torvalds at linux-foundation.org> writes:

> On Fri, Dec 14, 2012 at 8:52 AM, Jan Schubert <Jan.Schubert at gmx.li> wrote:
>>
>> OK, attached two samples to Ticket #38:
>
> Ugh. I'd forgotten how nasty the jdivelog xml is.
>
> Doing
>
>     sed 's/></>\n  </g'< ostc.jlb > readable.jlb
>
> makes it a bit better, and then you have beauties like
>
>   <T>60.0</T>
>   <TEMPERATURE>288.54999999999995</TEMPERATURE>
>
> That's sample time in tenths of a second, and temperatures in
> femto-degrees. That's readable.

Brilliant. Floating point for the win. There's a reason why I'm nudging
Jef to switch libdivecomputer to use integers for all values. So much
more reasonable and prevents at least some of this crap. Once you have
to convert your data to femptograde or centiseconds from a reasonably
designed integer that keeps presition and resolution in mind (say, mbar,
mm) maybe you wake up and say "umm, that doesn't make sense"?

But then, we shouldn't be too proud here - we picked mKelvin instead of
cKelvin :-)

> I dunno. I despise bad XML, and the #1 sign of bad XML is "not
> human-readable". The above is neither human-readable *nor* sane for a
> computer (ie the whole "tfs means NDL _or_ stop time" is a f*cking
> joke. Why not use "ndl" if that's what you mean?)

The temptation to do magic with these variables is always there. All the
dive computers appear to do it. My first implementation of deco / ndl
did it. We do it in libdivecomputer when passing data around:

the deco member of the sample union looks like this:

	struct {
		unsigned int type;
		unsigned int time;
		double depth;
	} deco;

And depending on the type

typedef enum dc_deco_type_t {
	DC_DECO_NDL,
	DC_DECO_SAFETYSTOP,
	DC_DECO_DECOSTOP,
	DC_DECO_DEEPSTOP
} dc_deco_type_t;

the time means NDL or stop time.

But yes, when writing out XML there is no excuse for the crap that
jdivelog does.

> (Seriously - why is subsurface the only project I've *ever* seen that
> tries to make the xml readable? Even if it ends up being bigger -
> which it doesn't in this case - it's worth it)
>
> And why the f*ck does jdivelog apparently give stop times and ndl
> times in *decimal* minutes? Christ. What unbelievable crap.

:-)

> But apart from the crazy jdivelog stuff, that does seem to be a very
> manly dive. Christ, and here I think going down to 200ft is going
> really deep.

Jan is your guy for manly dives. He's shared a complete download from
one of his computers with me when I was extending the OSTC support in
libdivecomputer.

"Manly rebreather diving" appears to be his middle name; he's also the
person who helped me take the first steps towards making Subsurface
useful for CCR diveers :-)

/D


More information about the subsurface mailing list