[Bug 669087] Re: QDateTime addSecs() is behaving strangely with Qt 4.7.0

hakaishi hakaishi at web.de
Sun Oct 31 14:15:40 UTC 2010


** Description changed:

- If adding less than 3*3600 secs everything is fine, but if it reaches three hours it adds one hour less. Note that this only occurs when adding to QDateTime SomeDateTime = dateEdit->dateTime(). For examle adding 3 hours results in SomeTime+2 hours. You have to add 3600s to get the right time. Another Example: To get Time+4 hours you have to add 5 hours instead (only if you want to add 3 or more hours (>=3*3600 secs).
+ 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
  qDebug() << timeInTheFuture; //returns the current date and 2 hours
- 
  
  And there is anoter 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

** 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
  qDebug() << timeInTheFuture; //returns the current date and 2 hours
  
- And there is anoter strange thing:
+ 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

** 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
- qDebug() << timeInTheFuture; //returns the current date and 2 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

-- 
QDateTime addSecs() is behaving strangely with Qt 4.7.0
https://bugs.launchpad.net/bugs/669087
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 mailing list