]> sigrok.org Git - libsigrok.git/commit
output/csv: Avoid accumulated timestamp error for odd samplerates
authorEarle F. Philhower, III <redacted>
Sat, 2 May 2020 17:45:22 +0000 (10:45 -0700)
committerGerhard Sittig <redacted>
Wed, 5 Aug 2020 18:53:57 +0000 (20:53 +0200)
commit01ac3eedfa23d8fea0804426393404e19e70035b
treeee0988d7a3882aedbb84236087b6560a81c58ca0
parentb81cfbc349a12e28f8212110699652b7e2d7aec4
output/csv: Avoid accumulated timestamp error for odd samplerates

The conversion of sample rates to sample periods and the repeated
addition of truncated values (integer variables) resulted in the
accumulation of errors in the timestamp column for odd samplerate
values. How to reproduce:

  $ sigrok-cli -d demo:analog_channels=0 \
      -c samplerate=6000000 --samples 1200001 \
      -O csv:time=true | tail

Accept the additional cost to reduce the error. Always get the timestamp
in a new calculation based on the sample number and the sample rate.

This addresses bug #1027.

Signed-off-by: Earle F. Philhower, III <redacted>
[ gsi: rephrased commit message, how to reprodue ]
src/output/csv.c