+QString CursorPair::format_string_sub(int time_precision, int freq_precision, bool show_unit)
+{
+ const pv::util::SIPrefix prefix = view_.tick_prefix();
+ const pv::util::Timestamp diff = abs(second_->time() - first_->time());
+
+ const QString time = Ruler::format_time_with_distance(
+ diff, diff, prefix, (show_unit ? view_.time_unit() : pv::util::TimeUnit::None),
+ time_precision, false);
+
+ // We can only show a frequency when there's a time base
+ if (view_.time_unit() == pv::util::TimeUnit::Time) {
+ const QString freq = util::format_value_si(
+ 1 / diff.convert_to<double>(), pv::util::SIPrefix::unspecified,
+ freq_precision, (show_unit ? "Hz" : nullptr), false);
+
+ return QString("%1 / %2").arg(time, freq);
+ } else
+ // In this case, we return the number of samples, really
+ return time;
+}
+