summaryrefslogtreecommitdiffstats
path: root/subsurface-core/load-git.c
diff options
context:
space:
mode:
Diffstat (limited to 'subsurface-core/load-git.c')
-rw-r--r--subsurface-core/load-git.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/subsurface-core/load-git.c b/subsurface-core/load-git.c
index f6b9f73aa..de7af80bf 100644
--- a/subsurface-core/load-git.c
+++ b/subsurface-core/load-git.c
@@ -9,6 +9,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <git2.h>
+#include <libdivecomputer/parser.h>
#include "gettext.h"
@@ -744,6 +745,16 @@ static void parse_dc_event(char *line, struct membuffer *str, void *_dc)
if (str->len)
name = mb_cstring(str);
ev = add_event(dc, event.time.seconds, event.type, event.flags, event.value, name);
+
+ /*
+ * Older logs might mark the dive to be CCR by having an "SP change" event at time 0:00.
+ * Better to mark them being CCR on import so no need for special treatments elsewhere on
+ * the code.
+ */
+ if (ev && event.time.seconds == 0 && event.type == SAMPLE_EVENT_PO2 && dc->divemode==OC) {
+ dc->divemode = CCR;
+ }
+
if (ev && event_is_gaschange(ev)) {
/*
* We subtract one here because "0" is "no index",