From 3c50e91a1096332df66b2d33d64e5a8dc9136ab9 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sun, 29 Oct 2023 19:56:40 +0100 Subject: [PATCH] Allow a zero timestamp for the first sample Previously the timestamp of the first sample was always a non-zero value, but the IX3M 2 with the APOS5 firmware now appears to record a timestamp of zero. This was incorrectly detected as a backwards time jump because the time is also initialized to zero. --- src/divesystem_idive_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/divesystem_idive_parser.c b/src/divesystem_idive_parser.c index c7f5fb4..6b286c0 100644 --- a/src/divesystem_idive_parser.c +++ b/src/divesystem_idive_parser.c @@ -440,8 +440,8 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba // Time (seconds). unsigned int timestamp = array_uint32_le (data + offset + 2); - if (timestamp <= time) { - ERROR (abstract->context, "Timestamp moved backwards."); + if (timestamp <= time && time != 0) { + ERROR (abstract->context, "Timestamp moved backwards (%u %u).", timestamp, time); return DC_STATUS_DATAFORMAT; } time = timestamp;