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

Method formatTime

src/utility.cpp:87–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87std::string Utility::formatTime(double seconds) {
88
89 if (seconds <= 0) {
90 return "00:00:00";
91 }
92
93 int h((int) seconds / 3600);
94 int min((int) seconds / 60 - h * 60);
95 int sec((int) seconds - (h * 60 + min) * 60);
96
97 std::ostringstream oss;
98 oss << std::setfill('0') << std::setw(2) << h << ":";
99 oss << std::setfill('0') << std::setw(2) << min << ":";
100 oss << std::setfill('0') << std::setw(2) << sec;
101
102 return oss.str();
103}
104
105std::string Utility::formatTimeShort(double seconds) {
106

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected