QDateTime addSecs() is behaving strangely with Qt 4.7.0

Bug #669087 reported by hakaishi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
qt4-x11 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

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 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();
thisTime.addSecs(3600);
qDebug()<<thisTime;

This returns only the current time. addSecs(3600) seems to be ignored.

Kind regards
 Hakaishi

Tags: grave
Revision history for this message
hakaishi (hakaishi) wrote :

Why does Ubuntu import packages from Debian Experimental??? - Is unstable not unstable enough?

hakaishi (hakaishi)
description: updated
hakaishi (hakaishi)
description: updated
description: updated
hakaishi (hakaishi)
description: updated
hakaishi (hakaishi)
description: updated
tags: added: grave
Revision history for this message
hakaishi (hakaishi) wrote :

The time calculation wasn't buggy after all... The "problem" was the winter time change.
Sorry for the false alarm.

Kind regards
 Hakaishi

Changed in qt4-x11 (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.