From 3f9133def9b9e30af9b9ce98546df06910a092b5 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 31 Jan 2017 22:44:02 +0100 Subject: [PATCH] Always use the sample timestamp as the base value With a time based sample interval, the number of samples for a single timestamp should be constant. However in practice some devices occasionally store fewer samples. Since our sample time is based purely on the sample interval, it goes completely out of sync with the sample timestamp. To avoid this problem, the sample timestamp is used as the base value. For the Oceanic Pro Plus 2, this problem is very noticable. After about 115 minutes into a dive, the sample interval appears to increase to 60 seconds. Thus, without this fix, the resulting dive time for long dives is suddenly much shorter than it should be. --- src/oceanic_vtpro_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oceanic_vtpro_parser.c b/src/oceanic_vtpro_parser.c index 859025e..1f9d7aa 100644 --- a/src/oceanic_vtpro_parser.c +++ b/src/oceanic_vtpro_parser.c @@ -333,7 +333,7 @@ oceanic_vtpro_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ // Time. if (interval) - time += interval; + time = timestamp * 60 + (i + 1) * interval; else time = timestamp * 60 + (i + 1) * 60.0 / count + 0.5; sample.time = time;