PDA

View Full Version : Invite QDateTime to go 8 secs on future uint



patrik08
6th June 2006, 22:43
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




bool check = false;
QDateTime timer1;
uint FAKENOW = timer1.toTime_t();
const uint MINWAITING = FAKENOW - (uint)8;
/*delete timer1;*/
QDateTime timer2;
timer2.addSecs((60 * 60) * 2);
const uint MAXWAITING = timer2.toTime_t();
qDebug() << "#### now ...." << FAKENOW;
qDebug() << "#### utimax ...." << MAXWAITING;
qDebug() << "#### utimin ...." << MINWAITING;
/* MAX & NOW are same ??? */
/*
QString esqlogg = QString( "SELECT WEBNUMMER FROM OGGETTO WHERE WEBNUMMER >=%1 AND WEBNUMMER =<%2 " ).arg( QString::number(mintime) , QString::number(maxtime) );
*/

jacek
6th June 2006, 22:51
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:
QDateTime timer1( QDateTime::currentDateTime() );

patrik08
6th June 2006, 23:03
timer2.addSecs((60 * 60) * 2);

is not jump on future....!!





QDateTime timer1( QDateTime::currentDateTime() );
const uint FAKENOW = timer1.toTime_t();
const uint MINWAITING = FAKENOW - (uint)8;
/*delete timer1;*/
QDateTime timer2( QDateTime::currentDateTime() );
timer2.addSecs((60 * 60) * 2);
const uint MAXWAITING = timer2.toTime_t();
qDebug() << "#### now ...." << UmanTimeFromUnix(FAKENOW);
qDebug() << "#### utimax ...." << UmanTimeFromUnix(MAXWAITING);
qDebug() << "#### utimin ...." << UmanTimeFromUnix(MINWAITING);
/* MAX & NOW are same ??? */
/*
QString esqlogg = QString( "SELECT WEBNUMMER FROM OGGETTO WHERE WEBNUMMER >=%1 AND WEBNUMMER =<%2 " ).arg( QString::number(mintime) , QString::number(maxtime) );
*/

jacek
6th June 2006, 23:14
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:
const uint MAXWAITING = timer2.addSecs( (60 * 60) * 2 ).toTime_t();

patrik08
6th June 2006, 23:26
now work ..... super .... tanks....