From 1a4798792e30b0d22d5d826e2691bfdd14bed908 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sun, 12 Sep 2021 19:43:02 +0200 Subject: [PATCH] Use the divetime stored in the header There is no need to calculate the total time from the pseudo profile, because the dive time is also stored in the header. --- src/mares_iconhd_parser.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/mares_iconhd_parser.c b/src/mares_iconhd_parser.c index 15fab95..52b56cb 100644 --- a/src/mares_iconhd_parser.c +++ b/src/mares_iconhd_parser.c @@ -697,13 +697,7 @@ mares_iconhd_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsi } else if (parser->model == SMARTAPNEA) { *((unsigned int *) value) = array_uint16_le (p + 0x24); } else if (parser->mode == ICONHD_FREEDIVE) { - unsigned int divetime = 0; - unsigned int offset = 4; - for (unsigned int i = 0; i < parser->nsamples; ++i) { - divetime += array_uint16_le (abstract->data + offset + 2); - offset += parser->samplesize; - } - *((unsigned int *) value) = divetime; + *((unsigned int *) value) = array_uint16_le (p + 0x0C); } else { *((unsigned int *) value) = parser->nsamples * parser->interval - parser->surftime; }