MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / globalTimeReference

Method globalTimeReference

pj_runtime/src/SessionManager.cpp:87–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87Timestamp SessionManager::globalTimeReference() const {
88 // Zero (absolute display) when the toggle is off. When on, the earliest raw
89 // sample ever observed across ALL datasets, applied uniformly. Per-dataset
90 // mins are pinned so live retention cannot slide the display origin forward.
91 if (!use_time_offset_) {
92 return 0;
93 }
94 if (!global_min_cache_.has_value()) {
95 Timestamp global_min = std::numeric_limits<Timestamp>::max();
96 bool found = false;
97 for (const DatasetId dataset_id : data_engine_.listDatasets()) {
98 // rememberDatasetMinTimestamp pins the earliest-ever min in a single scan
99 // (the current raw min only moves forward under retention, never below it).
100 const auto bounds = datasetRawBounds(dataset_id);
101 if (!bounds.has_value()) {
102 continue;
103 }
104 global_min = std::min(global_min, rememberDatasetMinTimestamp(dataset_id, bounds->first));
105 found = true;
106 }
107 global_min_cache_ = found ? global_min : 0;
108 }
109 return *global_min_cache_;
110}
111
112std::optional<std::pair<Timestamp, Timestamp>> SessionManager::datasetRawBounds(DatasetId dataset_id) const {
113 // The one scalar(DataEngine) + object(ObjectStore) time-bounds union. Shared by

Callers 2

TESTFunction · 0.80

Calls 1

listDatasetsMethod · 0.45

Tested by 1

TESTFunction · 0.64