lhchin has asked for the wisdom of the Perl Monks concerning the following question:

use Archive::Zip; my $zip = Archive::Zip->new(); $zip->addFile($0,'test.txt'); $zip->writeToFileNamed('test.zip');

Save the above code as zip.pm and run the following command and grep original and post zip Modify date to compare.
Perl Library Zipped file extracted is always 1 second behind original modify file? Is this a bug with the library???

stat zip.pm | grep Modify && perl zip.pm && unzip test.zip && stat test.txt| grep Modify && rm test.*

Output

Modify: 2017-01-03 01:15:55.000000000 -0800
Archive: test.zip
inflating: test.txt
Modify: 2017-01-03 01:15:54.000000000 -0800

Replies are listed 'Best First'.
Re: Archive::Zip Modify Date Oddity
by Corion (Patriarch) on Jan 03, 2017 at 09:32 UTC

    The Zip (file format) uses FAT timestamps which only have a resolution of two seconds.

      Thank you for sharing the info. If this is to mimic windows time stamp, it is not desirable. Further test verified it does round down the original file Modify date to lower even-seconds.
      It is not the case when tested using Windows GUI or Unix Shell from Perl to zip file, it does not modify the original Modify date of the file.
      As such I have submitted an enhancement request to the Archive::Zip Library in cspan.org for ZIP64 support for higher-resolution NTFS or Unix file timestamps

        Zip64 support doesn't have anything to do with the granularity of the timestamp recorded in the zip file. It just allows file larger than 4Gig to be stored in a zip archive.

        The two second time granularity is dealt with in modern zip implementations by storing an extended timestamp field.

        Archive::Zip::SimpleZip supports this field.