WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.



Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Timestamp Issues with zUnZipFiles

Keywords: 	 Timestamp zUnZipFiles 


I have written an internet upgrade utility which upgrades files using an internet sourced INI file to compare file dates. I have a problem in that it downloads the file and extracts it okay with zUnZipFiles, but the file time has increased by an hour.

You open the zip file and the time stamp is 4:49 and the extracted zip file is 5:49. I have two files that now do that. If I manually extract the zip file using Winzip, it is fine but using zUnZipfiles it adds a 1 hour time. It effects 2 out of 20 files in the zip. Any ideas?


Daylight Savings Time Overview:

Under WinNT (and some other platforms) file timestamps are stored in "file time" and translated to local "system time" by a formula based on the system's timezone, and whether or not Daylight Savings Time (DST) is in effect. The first problem is that when DST goes on or off, the formula changes - but the same formula is used for dates before and after the time change! Therefore, if last week you made note of a timestamp on a file on your server and you looked at it today, you'd see that the timestamp appears to have jumped forward one hour. Clearly, MS didn't want the overhead of a more complicated formula that conditionally adjusts for DST depending on the date of the timestamp.

The timezone part of the WinNT formula is nice if you have a far-flung network, or if your PC moves between time zones, but it's too bad that it doesn't handle DST better. (Actually, we'd probably all be better off without DST at all!)

That might be annoying by itself, but then the second problem comes in: The FAT file system under Win95/98 works in the opposite manner. Timestamps are stored as is and aren't affected by the system's timezone or DST. (If a program asks for the file's "file time", Windows fakes the answer by reversing the above formula.) So, the reported timestamp does not "jump" when DST changes.

If you have all FAT-based files systems, or all NTFS file systems, you probably wouldn't notice any of this. But when a Win95/98 PC is attached to a WinNT server and you move/compare files between them, then it's a real pain.

So it's a general disaster. Zippy complies with the way Windows NT with NTFS automagically adjusts for daylight savings time and displays the file's time stamp for the correct local time including Daylight Savings Time setting.

Winzip, on the other hand, is designed to keep the file times in the zip, and does not adjust for Daylight Savings Time, similarly to how Windows 95 OS works.

Basically.... There are two different ways that file times are stored in various file systems:

Local time and UTC time.

FAT is a local time system
NTFS is a UTC (Universal Coordinated Time) time system
Everytime is fine in FAT systems with respect to handling of DST (Daylight Savings Time). The Windows Explorer, our Zippy extender and WinZip all agree on how to do it on FAT systems.

However it turns out that on NTFS, WinZip and Zippy diverge in their treatment and adjustment of DST. However again, after figuring out this problem and seems that Windows Explorer and Zippy agree, and that WinZip is the odd man out.

Also note that it seems the dates are stored in ZIP file in UTC format. (Not 100% sure about this)

Basic test case:

On an NT system with both FAT and NTFS drives, set time to Jan 15 1:00 PM (any PST time).

Make two test files testfat.txt and testntfs.txt, and you need either two machines, one with FAT and the other with NTFS, or the same machine, with two drives, one NTFS, the other FAT.

Note file times. say:

testfat.txt = Jan 15 1:01 PM	  (create on the FAT drive)
testntfs.txt = Jan 15 1:02 PM	  (create on the NTFS drive)
Zip the two files into separate zip files onto the same hard drive. = Jan 15 1:03 PM	  (create on the FAT drive) = Jan 15 1:04 PM	  (create on the NTFS drive)

Now adjust the system time to June 6 (any PDT time).

Check file times. You will see:

testfat.txt = Jan 15 1:01 PM	  (on the FAT drive)
testntfs.txt = Jan 15 2:02 PM	  (on the NTFS drive) = Jan 15 1:03 PM	  (on the FAT drive) = Jan 15 2:04 PM	  (on the NTFS drive)
Great. Things are falling apart already.

Now unzip the zip files onto the same volume on their respective system. (I shudder to consider cross-volume zip/unzipping).


testfat.txt  Jan 15 1:01 PM
testntfs.txt Jan 15 2:02 PM

testfat.txt  Jan 15 1:01 PM
testntfs.txt Jan 15 1:02 PM
Note that Zippy and WinZip disagree for the NTFS volume.

Note that WinZip initially looks OK, as it is the time you zipped it. However note that the unzipped file has a timestamp one hour BEFORE the timestamp of the file on disk, indicating it is older than the original.

However the timestamp of the Zippy (InfoZip) unzipped file and the original file agree.

So there is a difference depending on the volume type that you place unzipped files on. AAAAAAAAAAAAAAAAhhhh

We've decided actually that Zippy and Windows Explorer have it correct, and that WinZip is breaking the rules.

Here's a table of how file times are affected, depending upon what file times are set in the zip file; an example of what Zippy does if your system time is set to either PDT (Pacific Daylight Time) or PST (Pacific Standard Time):

                    |   FILETIME     |   FILETIME     |
                    |     PDT        |      PST       |
                    |   SUMMER       |    WINTER      |
|  CURRENT TIME     |                |                |
|      PDT          | no adjustment  |   +1 hour      |
|    SUMMER         |                |                |
|  CURRENT TIME     |                |                |
|      PST          |    -1 hour     | no adjustment  |   
|    WINTER         |                |                |

Here are a couple of articles regarding timestamp issues and Windows to further clarify or confuse the issue. It's a nightmare:

Time Stamp Changes with Daylight Savings


Obtaining Universal Coordinated Time (UTC) from NTFS Files

Article ID:   W14446
Filename:   Timestamp Issues with zUnZipFiles.txt
File Created: 2017:07:28:13:58:56
Last Updated: 2007:05:31:11:47:58