[PATCH] Treat headings properly when importing Suunto logs

Dirk Hohndel dirk at hohndel.org
Tue Jan 1 13:04:50 PST 2013

Miika Turkia <miika.turkia at gmail.com> writes:

> This patch will convert a heading bookmark to Subsurface format.
> Suunto's bookmark uses "Heading: <degrees>" format and was previously
> set as the full event name. Now the resulting event will look like:
> <event name="heading" value="333°" time="0:58 min"/>
> Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
> ---
> I assume the resulting format is proper for Subsurface but did not see
> any samples, thus not sure. I am also not sure how the degree character
> (° or °) should be treated (after the numeric value). Currently it
> is not displayed by Subsurface.

That's because 'value' is actually defined to be an unsigned int by

        struct {
                unsigned int type;
                unsigned int time;
                unsigned int flags;
                unsigned int value;
        } event;

this is from the sample union that libdivecomputer defines - we match
this in Subsurface slightly differently:

struct event {
        struct event *next;
        duration_t time;
        int type, flags, value;
        gboolean deleted;
        char name[];

So we have an actual time and track a name instead of just the type. And
strangely enough, we have signed integers for type, flags and value.

Linus, any reason for that?

So what happens is that Suunto stores type and value in the string - and
we would like to match this as the name itself and then value as integer.

So, Miika - can you just drop the degree symbol and keep the integer


More information about the subsurface mailing list