Hi I need to be able to compare the last modified QDateTime's of two files that were copies of each other to tell if they have been modified and are no longer equal. One file is stored on an NTFS filesystem and the other is on FAT32. The file being modified is the NTFS one.

I am aware of the FAT32 2 second precision of the modified timestamp but the problem is after correcting for that I still need to be able to account for the effects of the system time zone DST settings. As it is now, during standard time, if a copy of the NTFS file was made to the FAT32 filesystem before standard time during daylight savings time, the two files as compared using QDateTime's have a difference of 1 hour after a restart (before restart the difference is 0). Is there any way to have Qt intelligently be aware of DST and recognize the time difference? Do I have to resort to the Win API or STL? Thanks.

Both Qt::UTC and Qt::LocalTime timespecs have the same results.

QDateTime sourceDateTime(sourceFileInfo.lastModified());
QDateTime targetDateTime(targetFileInfo.lastModified());

qint64 sourceMSecs(sourceDateTime.toMSecsSinceEpoch());
qint64 targetMSecs(targetDateTime.toMSecsSinceEpoch());

qint64 sourceMSecsAdjustedtoFAT32((sourceMSecs + 1999) / 2000 * 2000);

if ( sourceMSecsAdjustedtoFAT32 > targetMSecs ) .......
0

There are 0 answers