riverofwind
riverofwind

Reputation: 567

Is there a way to use GetFileTime or Win API to account for DST time change on FAT32 without restarting the computer to update the FAT32 UTC cache?

I am looking for a way to account for DST time changes in file modified timestamps on FAT32 without having to restart the computer first after DST takes effect. As it is now I can only account for DST by restarting the computer after DST occurs. I have a program that compares an NTFS file to a copy of it on a FAT32 filesystem and needs to detect if the file has been modified or not by comparing modified timestamps.

Here are the results of FileTimeToLocalFileTime and LocalFileTimeToFileTime comparing the difference in seconds between the NTFS source file and the FAT32 file. As you can see DST is not accounted for until after restart. I am Pacific Standard Time UTC - 8. This webpage explains the details. I have no problem with using STL or something like that as long as it can account for USA DST and hopefully other country's DSTs as well.

before restart

FileTimeToLocalFileTime applied to FAT32 file: NTFSSourceFile timestamp - fat32filetime timestamp 0
LocalFileTimeToFileTime applied to FAT32 file: NTFSSourceFile timestamp - fat32filetime timestamp -960

after restart

FileTimeToLocalFileTime applied to FAT32 file: NTFSSourceFile timestamp - fat32filetime timestamp -60
LocalFileTimeToFileTime applied to FAT32 file: NTFSSourceFile timestamp - fat32filetime timestamp -1040

Upvotes: 1

Views: 94

Answers (0)

Related Questions