+void View::determine_time_unit()
+{
+ // Check whether we know the sample rate and hence can use time as the unit
+ if (time_unit_ == util::TimeUnit::Samples) {
+ shared_lock<shared_mutex> lock(session().signals_mutex());
+ const unordered_set< shared_ptr<Signal> > &sigs(session().signals());
+
+ // Check all signals but...
+ for (const shared_ptr<Signal> signal : sigs) {
+ const shared_ptr<SignalData> data = signal->data();
+
+ // ...only check first segment of each
+ const vector< shared_ptr<Segment> > segments = data->segments();
+ if (!segments.empty())
+ if (segments[0]->samplerate()) {
+ set_time_unit(util::TimeUnit::Time);
+ break;
+ }
+ }
+ }
+}
+