From ca032783a283d798ce4603ae527b379f5964f934 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 14 Jan 2016 10:50:08 +0100 Subject: [PATCH] Fix the decoding of the dive time. I originally assumed the second byte contains the hour, but that turns out to be wrong. At least some of the bits have a different meaning. With only seconds and minutes, the maximum divetime is limited to at most 99 minutes and 59 seconds. That shouldn't be a problem for freedives. --- src/oceanic_atom2_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oceanic_atom2_parser.c b/src/oceanic_atom2_parser.c index 268f963..49cf13d 100644 --- a/src/oceanic_atom2_parser.c +++ b/src/oceanic_atom2_parser.c @@ -468,7 +468,7 @@ oceanic_atom2_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, uns case DC_FIELD_DIVETIME: if (parser->model == F10 || parser->model == F11A || parser->model == F11B) - *((unsigned int *) value) = bcd2dec (data[2]) + bcd2dec (data[3]) * 60 + bcd2dec (data[1]) * 3600; + *((unsigned int *) value) = bcd2dec (data[2]) + bcd2dec (data[3]) * 60; else *((unsigned int *) value) = parser->divetime; break;