Reputation: 55
I am writing a program that asks the user for a large number of seconds and waits that many seconds. The issue is that as soon as waitSecs is larger 9999 seconds, launchTime seems to become a random number. I've outputted waitSecs using qDebug and it is the correct number (even when the number is larger than 9999). Any help?
QTime launchTime = QTime::currentTime().addSecs(waitSecs);
Here is the code + output:
Upvotes: 1
Views: 141
Reputation: 5345
From Qt documentation http://qt-project.org/doc/qt-4.8/qtime.html#addSecs:
QTime QTime::addSecs ( int s ) const
Returns a QTime object containing a time s seconds later than the time of this object (or earlier if s is negative).
Note that the time will wrap if it passes midnight.
Consider using QDateTime instead...
Upvotes: 2