I've found the following strange behaviour of QDateTime on Qt 4.7-beta1, to generate a GPX
timestamp for new waypoints i use the following code:
QDateTime curtime = QDateTime::currentDateTime().toUTC();
QString timestamp = curtime.toString("yyyy-MM-ddThh:mm:ssZ");
However, the resulting timestamp doesn't even come close to the current date & time...
It gives me 1950-01-31T04:25:25 when the phone itself has a time of 09:16 and date today...
Now i would expect some offset due to the localtime versus UTC time, but that is usually only
an hour, or 2, depending on daylight saving time. It should not be 4 hours and 51 minutes off...
And then the date... why does it think it is january 31st 1950?
Am i doing something wrong here?
(happens both in emulator and on device. on another development machine with Qt 4.6.3 running
the same code on the emulator the behaviour is as expected)
Elsewhere in my program, I'm using QTime to query the current time (not UTC), and when querying hours/minutes/seconds for my clock, everything is correct:
QTime time = QTime::currentTime();
int second = time.second();
int minute = time.minute();
int hour = time.hour();