MCPcopy Create free account
hub / github.com/benapetr/TuxManager / SimplifyTime

Method SimplifyTime

src/misc.cpp:28–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26#include <QtGlobal>
27
28QString Misc::SimplifyTime(int secs)
29{
30 if (secs < 0)
31 secs = 0;
32
33 if (secs > 0 && (secs % 3600) == 0)
34 {
35 const int hours = secs / 3600;
36 return QString::number(hours) + ((hours == 1) ? " hour" : " hours");
37 }
38
39 if (secs > 0 && (secs % 60) == 0)
40 {
41 const int minutes = secs / 60;
42 return QString::number(minutes) + ((minutes == 1) ? " minute" : " minutes");
43 }
44
45 return QString::number(secs) + ((secs == 1) ? " second" : " seconds");
46}
47
48QString Misc::SimplifyTimeMS(int ms)
49{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected