feat: relative mode keeps the stream's absolute clock for the export

This commit is contained in:
Martino Ferrari committed 2026-10-08 17:20:47 +02:00
1 parent d11e7d48c4
commit 57e2f6aa8b
6 files changed
+87 -9

No files matched your search

+11 -2
View File
@@ -127,7 +127,9 @@ ExportTable collect_export(ScopeModel& model, RowSet& rows) {
table.abs_seconds.resize(n);
for (std::size_t i = 0; i < n; ++i) {
table.time[i] = st[first + i];
table.abs_seconds[i] = abs_base + table.time[i];
table.abs_seconds[i] = snap->abs_stamps.empty()
? abs_base + table.time[i]
: snap->abs_stamps[first + i];
}
for (const int c : chans) {
const std::size_t ch = static_cast<std::size_t>(c);
@@ -159,9 +161,16 @@ ExportTable collect_export(ScopeModel& model, RowSet& rows) {
store.time().copy_from(first, n, stamps.data());
table.time.resize(static_cast<std::size_t>(n));
table.abs_seconds.resize(static_cast<std::size_t>(n));
std::vector<f64> abs_stamps;
if (const plot::data::RingBuffer<f64>* abs_ring = store.abs_time(); abs_ring != nullptr) {
abs_stamps.resize(static_cast<std::size_t>(n));
abs_ring->copy_from(first, n, abs_stamps.data());
}
for (std::size_t i = 0; i < stamps.size(); ++i) {
table.time[i] = stamps[i] - s0;
table.abs_seconds[i] = abs_base + table.time[i];
table.abs_seconds[i] = abs_stamps.empty()
? abs_base + table.time[i]
: model.epoch() + abs_stamps[i];
}
for (const int c : chans) {
const std::size_t ch = static_cast<std::size_t>(c);