MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / formatTimeTick

Method formatTimeTick

app/src/UI/Widgets/Waterfall.cpp:1256–1263  ·  view source on GitHub ↗

* @brief Formats a time value -- integer seconds when step >= 1, decimals otherwise. */

Source from the content-addressed store, hash-verified

1254 * @brief Formats a time value -- integer seconds when step >= 1, decimals otherwise.
1255 */
1256QString Widgets::Waterfall::formatTimeTick(double seconds, double step)
1257{
1258 if (step >= 1.0)
1259 return QString::number(std::round(seconds), 'f', 0);
1260
1261 const int decimals = std::max(0, -static_cast<int>(std::floor(std::log10(step))));
1262 return QString::number(seconds, 'f', decimals);
1263}
1264
1265//--------------------------------------------------------------------------------------------------
1266// View state (zoom / pan / axis visibility)

Callers

nothing calls this directly

Calls 3

floorFunction · 0.85
log10Function · 0.85
roundFunction · 0.50

Tested by

no test coverage detected