- const unsigned int relative_prec =
- (prefix >= SIPrefix::none) ? precision :
- std::max((int)(precision - prefix_order), 0);
-
- return format_si_value(t, unit, prefix, relative_prec);
-}
-
-QString format_time(const Timestamp& t, SIPrefix prefix, TimeUnit unit,
- unsigned int precision)
-{
- // Make 0 appear as 0, not random +0 or -0
- if (t.is_zero())
- return "0";
-
- // If we have to use samples then we have no alternative formats
- if (unit == TimeUnit::Samples)
- return format_time_with_si(t, "sa", prefix, precision);
-
- // View in "normal" range -> medium precision, medium step size
- // -> HH:MM:SS.mmm... or xxxx (si unit) if less than 60 seconds
- // View zoomed way in -> high precision (>3), low step size (<1s)
- // -> HH:MM:SS.mmm... or xxxx (si unit) if less than 60 seconds
- if (abs(t) < 60)
- return format_time_with_si(t, "s", prefix, precision);
- else
- return format_time_in_full(t, precision);
-}
+ while ((pos = text.find(separator)) != std::string::npos) {
+ result.push_back(text.substr(0, pos));
+ text = text.substr(pos + separator.length());
+ }
+ result.push_back(text);