MCPcopy Create free account
hub / github.com/Cpasjuste/pplay / formatTimeShort

Method formatTimeShort

src/utility.cpp:105–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105std::string Utility::formatTimeShort(double seconds) {
106
107 int h((int) seconds / 3600);
108 int min((int) seconds / 60 - h * 60);
109 int sec((int) seconds - (h * 60 + min) * 60);
110
111 std::ostringstream oss;
112 if (h > 0) {
113 oss << std::setfill('0') << std::setw(2) << h << ":";
114 }
115 if (min > 0) {
116 oss << std::setfill('0') << std::setw(2) << min << ":";
117 }
118 oss << std::setfill('0') << std::setw(2) << sec;
119
120 return oss.str();
121}
122
123static std::string convertToString(double num) {
124 std::ostringstream convert;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected