PDA

View Full Version : [SOLVED] QDateTime (revisited)



pdoria
31st July 2009, 13:04
Hi,

I have this 32 bit value which represents the number of seconds since 1989-12-31 00:00:00

Looking at the fxs:
toTime_t ()
fromTime_t ()

Their starting date is 1970-01-01T00:00:00

I've tried:

QDateTime dateTime;
QDateTime dateTimeStart;

//! \note Date/Time starts at 1989-12-31 00:00:00
dateTimeStart = QDateTime::fromString("M12d31y8900:00:00", "'M'M'd'd'y'yyhh:mm:ss");
quint16 start = dateTimeStart.toTime_t();

dateTime=QDateTime::fromTime_t ( driver_id_data.status_change_time + start );
humanDate = dateTime.toString ( "yyyy-MM-dd hh:mm:ss" );

This obviously fails due to the nature of fromTime_t() and toTime_t() ...

So the real question here is:
How can I add that 32 bit value to dateTimeStart ?

TIA,
Pedro Doria Meunier

pdoria
31st July 2009, 13:12
ooooops! My bad! :o:o:o

I should have :

quint32 start = dateTimeStart.toTime_t();

instead of:

quint16 start = dateTimeStart.toTime_t();

Deeply sorry for the noise ... :o

BR,
Pedro.