Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Could QTime used like this kind of timer?
There are some device that need record they working time .So I need QTime to record the time.
const QString TIME_FORMAT = "hh:mm:ss"; //...... deviceWork_Time->addSec(100); deviceWork_Time->addSec(3600); deviceWork_Time->addSec(1800); //...... qDebug()<<"Work Time:"<<deviceWok_Time.toString(TIME_FORMAT);
The programme will tell user "Work Time:1:31:40";
In fact,the device will work continue for a few days , so I hope QTime can show like
"Work Time: 121:20:40"
Now user can know the device had work 121hours and 20 minutes and 40 second.But if the time more than 24 hours,the QTme will show the time is "0:00:00"...
JonB last edited by
QTimeonly uses a "24-hour clock time". It will not return a number of elapsed hours greater than 24.
Do you have some better idea that's can recod this format time?
IIRC QTime only works for 0 to 86399, aka 23h 59m and 59 sec
you can call start() on a QTime object and it will start counting the seconds, (starting with 00:00:00)
to recorde more than 24 hours, you'll have to use a QDateTime object, or monitor it yourself.