Reading the function AddTimeData, I came to notice two things:
- The structure vTimeOffsets contains up to 200 elements, after which any new element added to it will not increase its size, replacing the oldest element.
- The condition to update nTimeOffset includes checking whether the number of elements in vTimeOffsets is odd, which will never happen after there are 200 elements.
This will lead to nTimeOffset not updating past 199 calls to AddTimeData, remaining forever stuck in whatever value it had then. I don’t believe this is the inteded behaviour. I would suggest removing the oddness check, since vTimeOffsets is capable of returning the median value of an even list according to the median method of the CMedianFilter type.
In current master, the offending code is in src/timedata.cpp, line 52, columns 34-64:
0if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1)
This should better be:
0if (vTimeOffsets.size() >= 5)