Page Bottom  Documentation

File Time


Did I write you the other day saying I'd given up on FileTime ? I think I may have figured it out. It's still not automatic, since you can't fight Microsoft if they physically change the times on you (or like the CD-RW at work, adds another hour to compensate for DST for a file already stamped in DST.) But I think all your code needs to know is whether standard or daylight savings is in effect, and you just supply the desired time-zone offsets from UTC.

This workspace contains a bunch of Windows API covers, but the principle function of interest is named GetRealFileTime (reality being relative of course.) The rarg is a path\filename and the larg is the time-zone offset from UTC in minutes. So if your file on CD was written in eastern time (standard or daylight-savings), supply 300 as the larg. If you are comparing it to a file on hard disk (whose time Windows can change), supply 300 for that file if the current time-zone is EST, or 240 if now in EDT. This should allow you to compare the two files correctly.

EST: 300 GetRealFileTime 'c:\myfile.txt' should equal 300 GetRealFileTime 'x:\myfile.txt'

EDT: 240 GetRealFileTime 'c:\myfile.txt' should equal 300 GetRealFileTime 'x:\myfile.txt'

I just changed my time setting (Windows 2000) to non-daylight time, and this test gave the correct results. (One caveat if you try this at home: when you switch back to DST, Windows doesn't update it's filetime cache until you re-boot, so 300 GetRealFileTime will still show equal times for both files if you check them again before re-booting. Aftre that you have to use 300 for CD files, 240 for the files Windows can change.)

I hope this is clear (or becoming so -- it's still a bit of a whirl for me.) When you can, try it out on your machine and see if it works the way you want. One additional caveat: the SystemTimeToTzSpecificLocalTime function is only available on NT4+ -- it will not work on Win95/98/ME.

If these functions work, feel free to inline any of the subfunctions. I left them in for clarity and to make sure non-standard aplw.adf definitions are created. Once those are done, it would be simpler to inline the simple quadWCALLs.

Let me know if you have any questions.

Bill (wrp)

horizontal line
to home page e-mail Page Top