MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / format_real_time

Method format_real_time

DSView/pv/view/ruler.cpp:175–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175QString Ruler::format_real_time(uint64_t delta_index, uint64_t sample_rate)
176{
177 double v1 = (double)std::pow(10, 12) / (double)sample_rate;
178 double delta_time_double = v1 * delta_index;
179 uint64_t delta_time = v1 * delta_index;
180
181 if (delta_time_double > UINT64_MAX){
182 return "INF";
183 }
184
185 if (delta_time == 0) {
186 return "0";
187 }
188
189 int zero = 0;
190 int prefix = (int)floor(log10(delta_time));
191 while(delta_time == (delta_time/10*10)) {
192 delta_time /= 10;
193 zero++;
194 }
195
196 return format_time(delta_time / std::pow(10.0, 12-zero), prefix/3+1, prefix/3*3 > zero ? prefix/3*3 - zero : 0);
197}
198
199QString Ruler::format_real_freq(uint64_t delta_index, uint64_t sample_rate)
200{

Callers 5

get_cm_timeMethod · 0.80
get_cm_deltaMethod · 0.80
get_index_deltaMethod · 0.80
measureMethod · 0.80
paintMeasureMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected