Commit f967f24a authored by Vishesh Handa's avatar Vishesh Handa
Browse files

time_t bug

parent 26dc804e
......@@ -24,6 +24,8 @@
#include <QApplication>
#include <QTimer>
#include <QFileInfo>
#include <QDateTime>
#include <KDebug>
#include <iostream>
......@@ -41,6 +43,21 @@ private Q_SLOTS:
int main(int argc, char** argv)
{
/*
QString str("2012-10-28T02:03:01");
QDateTime mtime = QDateTime::fromString(str, Qt::ISODate);
uint t = 1351382581;
QDateTime lm = QDateTime::fromTime_t(t);
qDebug() << lm << mtime;
bool r1 = mtime != lm;
bool r2 = mtime != lm;
qDebug() << r1 << r2;
return 0;
*/
App app(argc, argv);
if (argc != 2) {
......
......@@ -177,8 +177,12 @@ bool BasicIndexingQueue::shouldIndex(FileMapping& file, const QString& mimetype)
const QString str = QString::fromStdString(*it).mid(4);
const QDateTime mtime = QDateTime::fromString(str, Qt::ISODate);
if (mtime != fileInfo.lastModified())
const QDateTime lm = fileInfo.lastModified();
// Using time_t because there seems to be a bug in QDateTime::fromTime_t which is what
// QFileInfo::lastModified uses internally
if (lm.toTime_t() != mtime.toTime_t()) {
return true;
}
}
catch (const Xapian::DocNotFoundError&) {
return true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment