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

Function formatDuration

app/src/Sessions/HtmlReport.cpp:102–118  ·  view source on GitHub ↗

* @brief Formats a millisecond duration as HH:MM:SS. */

Source from the content-addressed store, hash-verified

100 * @brief Formats a millisecond duration as HH:MM:SS.
101 */
102static QString formatDuration(qint64 ms)
103{
104 if (ms <= 0)
105 // code-verify off
106 return QStringLiteral("—");
107 // code-verify on
108
109 const qint64 totalSeconds = ms / 1000;
110 const qint64 hours = totalSeconds / 3600;
111 const qint64 minutes = (totalSeconds / 60) % 60;
112 const qint64 seconds = totalSeconds % 60;
113
114 return QString::asprintf("%02lld:%02lld:%02lld",
115 static_cast<long long>(hours),
116 static_cast<long long>(minutes),
117 static_cast<long long>(seconds));
118}
119
120/**
121 * @brief Re-formats an ISO 8601 timestamp in the DB Explorer's display style.

Callers 2

buildCoverSectionMethod · 0.85
buildMetadataSectionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected