Results 1 to 5 of 5

Thread: Invite QDateTime to go 8 secs on future uint

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Invite QDateTime to go 8 secs on future uint

    The Life on php is much better...

    Why here on this code FAKENOW & MAXWAITING are Same?
    only MINWAITING is correct?..

    on php:

    $now=date(U);
    $min= date(U) - 8;
    $max= date(U) + 8; // future work ok & QT not...

    uint now + 8 = 0 NULL

    Qt Code:
    1. bool check = false;
    2. QDateTime timer1;
    3. uint FAKENOW = timer1.toTime_t();
    4. const uint MINWAITING = FAKENOW - (uint)8;
    5. /*delete timer1;*/
    6. QDateTime timer2;
    7. timer2.addSecs((60 * 60) * 2);
    8. const uint MAXWAITING = timer2.toTime_t();
    9. qDebug() << "#### now ...." << FAKENOW;
    10. qDebug() << "#### utimax ...." << MAXWAITING;
    11. qDebug() << "#### utimin ...." << MINWAITING;
    12. /* MAX & NOW are same ??? */
    13. /*
    14.   QString esqlogg = QString( "SELECT WEBNUMMER FROM OGGETTO WHERE WEBNUMMER >=%1 AND WEBNUMMER =<%2 " ).arg( QString::number(mintime) , QString::number(maxtime) );
    15.   */
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Invite QDateTime to go 8 secs on future uint

    Quote Originally Posted by patrik08
    The Life on php is much better...
    Life is much better when one reads the docs:
    QDateTime::QDateTime ()
    Constructs a null datetime (i.e. null date and null time). A null datetime is invalid, since the date is invalid.
    Try:
    Qt Code:
    1. QDateTime timer1( QDateTime::currentDateTime() );
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Invite QDateTime to go 8 secs on future uint

    timer2.addSecs((60 * 60) * 2);

    is not jump on future....!!


    Qt Code:
    1. QDateTime timer1( QDateTime::currentDateTime() );
    2. const uint FAKENOW = timer1.toTime_t();
    3. const uint MINWAITING = FAKENOW - (uint)8;
    4. /*delete timer1;*/
    5. QDateTime timer2( QDateTime::currentDateTime() );
    6. timer2.addSecs((60 * 60) * 2);
    7. const uint MAXWAITING = timer2.toTime_t();
    8. qDebug() << "#### now ...." << UmanTimeFromUnix(FAKENOW);
    9. qDebug() << "#### utimax ...." << UmanTimeFromUnix(MAXWAITING);
    10. qDebug() << "#### utimin ...." << UmanTimeFromUnix(MINWAITING);
    11. /* MAX & NOW are same ??? */
    12. /*
    13.   QString esqlogg = QString( "SELECT WEBNUMMER FROM OGGETTO WHERE WEBNUMMER >=%1 AND WEBNUMMER =<%2 " ).arg( QString::number(mintime) , QString::number(maxtime) );
    14.   */
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Invite QDateTime to go 8 secs on future uint

    Quote Originally Posted by patrik08
    is not jump on future....!!
    QDateTime QDateTime::addSecs ( int nsecs ) const
    Returns a QDateTime object containing a datetime nsecs seconds later than the datetime of this object (or earlier if nsecs is negative).
    Try:
    Qt Code:
    1. const uint MAXWAITING = timer2.addSecs( (60 * 60) * 2 ).toTime_t();
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to jacek for this useful post:

    patrik08 (6th June 2006)

  6. #5
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Invite QDateTime to go 8 secs on future uint

    now work ..... super .... tanks....

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.