Why is QDateTime operator < seems to not work? [solved]
-
Debugger contents.
Locals
nowUTC Thu Apr 11 22:18:31 2013 QDateTimepIndex @0xb971700 Meeting
mBody "This is the body of a placeholder meeting." std::string
mDateTimeUTC Thu Apr 11 22:08:10 2013 QDateTime
mHeader "This is a fake meeting." std::string
resave false bool
this @0x28fe20 MeetingManager
Inspector
Expressions
Return Value
TooltipLine that doesn't work, at the same time the above was taken from debugger.
if ( pIndex->mDateTimeUTC < nowUTC )
-
I solved this problem, but I had to look at the source code of Qt to see that the function is doing more than just comparing the times it also does work to compare time specs. The docs only say...
bool QDateTime::operator<(const QDateTime & other) const
Returns true if this datetime is earlier than the other datetime; otherwise returns false.So when I pulled my QDateTime from file the timespec was lost and I guess it assumed local, so setting the time spec to UTC after pulling from the file makes it work now.
Someone should probably add a line to the docs that says the extra work is done.
-
Hi,
You could open a bug report for the documentation to have it updated