MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / formatSeconds

Function formatSeconds

Source/RewardsPage.cpp:193–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193std::string formatSeconds(int seconds)
194{
195 int hours = seconds / 3600;
196 int minutes = (seconds % 3600) / 60;
197 int remainingSeconds = seconds % 60;
198
199 std::string formattedTime;
200
201 if (hours > 0)
202 {
203 formattedTime += fmt::format("{}h ", hours);
204 }
205
206 if (minutes > 0 || (hours == 0 && minutes == 0))
207 {
208 formattedTime += fmt::format("{}min", minutes);
209 }
210
211 if (hours == 0 && minutes == 0 && remainingSeconds > 0)
212 {
213 formattedTime = fmt::format("{}sec", remainingSeconds);
214 }
215
216 return formattedTime;
217}
218
219void RewardsPage::onHttpRequestCompleted(ax::network::HttpClient* sender, ax::network::HttpResponse* response)
220{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected