[Qt-interest] Strange problem storing and retrieving and comparing QTime/QDataTime
Mihail Naydenov
mlists at ymail.com
Tue Nov 17 12:55:57 CET 2009
Thank You for your response.
timeSpec() on both returns 0 (Qt::LocalTime)
converting both toTimeSpec(Qt::UTC), just for a try, and comparison again failed.
However "converting" toTime_t(), actually made the test pass!
I guess both objects do hold identical time-data, but some other property keeps them away from reporting equal...
May be the way they are constructed, I dont know. I also tried manually reading from db as string and creating QDateTime, the results were the same.
Thanks, anyway
MihailNaydenov
----- Original Message ----
> From: Julien Cugnière <julien.cugniere at gmail.com>
> To: Mihail Naydenov <mlists at ymail.com>
> Cc: qt-interest at trolltech.com
> Sent: Tue, November 17, 2009 12:49:22 PM
> Subject: Re: [Qt-interest] Strange problem storing and retrieving and comparing QTime/QDataTime
>
> 2009/11/17 Mihail Naydenov
> > Also *only the QTime part fails*! This is
> >
> > lastmod.date() == currlastmod.date()
> >
> > also passes, but lastmod.time() == currlastmod.time() does not.
> > (Again if I toString() them they pass)
>
> Check lastmod.timeSpec() and currlastmod.timeSpec(). Probably one is
> local and the other UTC. If this is the problem, then you should
> probably use toLocal() or toUTC() on the dates you read from the
> database, to ensure that they're in the same timeSpec as used in the
> rest of your application.
>
> --
> Julien Cugnière
More information about the Qt-interest-old
mailing list