Sometimes MKVI records sample time erroneously and we have to "fix" the time. The 2 samples (from single DC) I have seen suffering this issue can be corrected by subtracting 65528 from the sample time.
Fixes #916 Signed-off-by: Miika Turkia <miika.tur...@gmail.com> --- file.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/file.c b/file.c index 8522b2e..5afc91c 100644 --- a/file.c +++ b/file.c @@ -651,7 +651,14 @@ int parse_txt_file(const char *filename, const char *csv) has_setpoint = false; has_ndl = false; sample = prepare_sample(dc); - sample->time.seconds = cur_sampletime; + + /* + * Sometimes MKVI records sample time erroneously and we have to "fix" the + * time. The 2 samples (from single DC) I have seen suffering this issue can + * be corrected by subtracting 65528 from the sample time. + */ + + sample->time.seconds = cur_sampletime > 65000 ? cur_sampletime - 65528 : cur_sampletime; do { int i = sscanf(lineptr, "%d,%d,%d", &sampletime, &type, &value); -- 2.1.4 _______________________________________________ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface