[Bug 669087] Re: QDateTime addSecs() is behaving strangely with Qt 4.7.0
hakaishi at web.de
Sun Oct 31 14:32:47 UTC 2010
** Description changed:
If adding less than 3*3600 seconds (3 hours) everything is fine, but if it reaches three hours it adds one hour less. Note that this only occurs when the set date is the current date. For examle adding 3 hours results in SomeTime+2 hours.
An example code would look like this:
- QDateTime nextDate = dateEdit->dateTime(); //the date is the current date
- QDateTime timeInTheFuture = nextDate.addSecs(3*3600); //or (even if only one second) more than 3 hours
+ QDateTime today = QDateTime(QDate(2010,10,31)); //current date
+ QDateTime timeInTheFuture = today.addSecs(3*3600); //or (even if only one second) more than 3 hours
qDebug() << timeInTheFuture; //returns the current date 2 o'clock instead of 3 o'clock
And there is another strange thing:
QDateTime thisTime = QDateTime::currentDateTime();
This returns only the current time. addSecs(3600) seems to be ignored.
** Tags added: grave
QDateTime addSecs() is behaving strangely with Qt 4.7.0
You received this bug notification because you are a member of Kubuntu
Bugs, which is subscribed to qt4-x11 in ubuntu.
More information about the kubuntu-bugs