ETHZ-TEC / RocketLogger

Official development repository of the RocketLogger project.
https://github.com/ETHZ-TEC/RocketLogger/wiki
BSD 3-Clause "New" or "Revised" License
14 stars 4 forks source link

Invalid sample timestamps for last data block #30

Closed lsigrist closed 3 years ago

lsigrist commented 3 years ago

Description

When using the local or network absolute time references for the sample timestamp calculation with get_time(), the timestamps of the last data block are all equal.

How Reproduced

RocketLogger version: release-2.0.0 branch, revision 345504a70ac09e4c7c95f971248d47738fbed36d or later

Run the latest Python test cases, e.g. using test_coverage.sh. The following two test cases (introduced as part of bugfix #13) fail with:

======================================================================
FAIL: test_get_time_absolute_local_scaling (rocketlogger.tests.test_data.TestDataHandling)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./script/python/rocketlogger/tests/test_data.py", line 1161, in test_get_time_absolute_local_scaling
    self.assertAlmostEqual(dtemp / dt, 1)
AssertionError: 0.8001504703443878 != 1 within 7 places (0.1998495296556122 difference)
======================================================================
FAIL: test_get_time_absolute_network_scaling (rocketlogger.tests.test_data.TestDataHandling)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./script/python/rocketlogger/tests/test_data.py", line 1171, in test_get_time_absolute_network_scaling
    self.assertAlmostEqual(dtemp / dt, 1)
AssertionError: 0.8001504703443878 != 1 within 7 places (0.1998495296556122 difference)

Workaround

a) Ignore the last data block in the calculations when not working with relative timestamp, or b) fall back to use the relative timestamps.