I have a function that returns a QDateTime class, with the following code:
QDateTime Foo:IntToQDateTime( int Date )
{
int Second = 4,
Minute = 3,
Hour = 22,
Day = 10,
Month = 11,
Year = 2011;
QDate d(Year, Month, Day);
QTime t(Hour, Minute, Second);
QDateTime r(d, t);
return r;
}
That produces r with null strings/time_t of 4294967295, yet d and t are both accurate.
If I change the code to:
QDateTime Foo:IntToQDateTime( int Date )
{
int Second = 4,
Minute = 3,
Hour = 22,
Day = 10,
Month = 11,
Year = 2011;
QDate d(Year, Month, Day); // November 11 2011
QTime t(Hour, Minute, Second);// 22:03:04:00
QDateTime r(QDate(Year, Month, Day), QTime(Hour, Minute, Second));
return r;
}
r is now “Fri Nov 8 00:56:47 16182” with a time_t of 4294967295 (same as above). Can anyone explain to me why a.) the date/time is inaccurate for the QDateTime class r, and why b.) passing d and t as apposed to QDate(...), QTime(...) in the constructor also affects the date/time.
How did you determine the values you reported?
With this program:
I get the following output with Qt 4-8.0, MSVC-2010-Express, German Windows7/64:
Are you sure that your environment is correct and that you do not see some artefact of debugging?