classification
Title: Timestamp stored in ZIP file not correct ?
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: loewis, pythonmeister
Priority: normal Keywords:

Created on 2008-06-29 08:08 by pythonmeister, last changed 2008-06-29 08:54 by loewis. This issue is now closed.

Files
File name Uploaded Description Edit
ziptest.py pythonmeister, 2008-06-29 08:08 Python file reproducing the error
ziptest.py pythonmeister, 2008-06-29 08:17
Messages (4)
msg68934 - (view) Author: Stefan Sonnenberg-Carstens (pythonmeister) Date: 2008-06-29 08:08
Given the attached source, I can produce these results:

[stefan@localhost ~]$ python ziptest.py 
Start 10:05:54
ZIP stored mtime: (2008, 6, 29, 10, 5, 54)
Original mtime: (2008, 6, 29, 10, 5, 54)
Duration 0.00291705131531
Stop 10:05:54
------------------------------
Start 10:05:55
ZIP stored mtime: (2008, 6, 29, 10, 5, 54)
Original mtime: (2008, 6, 29, 10, 5, 55)
Duration 0.00302505493164
Stop 10:05:55
------------------------------
Start 10:05:56
ZIP stored mtime: (2008, 6, 29, 10, 5, 56)
Original mtime: (2008, 6, 29, 10, 5, 56)
Duration 0.00260186195374
Stop 10:05:56
------------------------------
Start 10:05:57
ZIP stored mtime: (2008, 6, 29, 10, 5, 56)
Original mtime: (2008, 6, 29, 10, 5, 57)
Duration 0.00173997879028
Stop 10:05:57
------------------------------
Start 10:05:58
ZIP stored mtime: (2008, 6, 29, 10, 5, 58)
Original mtime: (2008, 6, 29, 10, 5, 58)
Duration 0.00218915939331
Stop 10:05:58
------------------------------
Start 10:05:59
ZIP stored mtime: (2008, 6, 29, 10, 5, 58)
Original mtime: (2008, 6, 29, 10, 5, 59)
Duration 0.00273489952087
Stop 10:05:59
------------------------------
Start 10:06:00
ZIP stored mtime: (2008, 6, 29, 10, 6, 0)
Original mtime: (2008, 6, 29, 10, 6, 0)
Duration 0.00237393379211
Stop 10:06:00
------------------------------
Start 10:06:01
ZIP stored mtime: (2008, 6, 29, 10, 6, 0)
Original mtime: (2008, 6, 29, 10, 6, 1)
Duration 0.00279211997986
Stop 10:06:01
------------------------------
Start 10:06:02
ZIP stored mtime: (2008, 6, 29, 10, 6, 2)
Original mtime: (2008, 6, 29, 10, 6, 2)
Duration 0.00237607955933
Stop 10:06:02
------------------------------
Start 10:06:03
ZIP stored mtime: (2008, 6, 29, 10, 6, 2)
Original mtime: (2008, 6, 29, 10, 6, 3)
Duration 0.0018618106842
Stop 10:06:03
------------------------------


I also printed the duration to see if it passes from one second to another.
It doesn't.
The behaviour is the same with ZIP_STORED as storage type.
msg68935 - (view) Author: Stefan Sonnenberg-Carstens (pythonmeister) Date: 2008-06-29 08:09
[stefan@localhost ~]$ python -V
Python 2.5.1
[stefan@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.25.6-55.fc9.i686 #1 SMP Tue Jun 10
16:27:49 EDT 2008 i686 i686 i386 GNU/Linux
msg68936 - (view) Author: Stefan Sonnenberg-Carstens (pythonmeister) Date: 2008-06-29 08:17
I changed the script a bit, so that the txt file is not getting
recreated every time.
It gives:

[stefan@localhost ~]$ python ziptest.py 
Start 10:15:05
ZIP stored mtime: (2008, 6, 29, 10, 15, 4)
Original mtime: (2008, 6, 29, 10, 15, 5)
Duration 0.00438690185547
Stop 10:15:05
------------------------------
Start 10:15:06
ZIP stored mtime: (2008, 6, 29, 10, 15, 4)
Original mtime: (2008, 6, 29, 10, 15, 5)
Duration 0.00189399719238
Stop 10:15:06
------------------------------
Start 10:15:07
ZIP stored mtime: (2008, 6, 29, 10, 15, 4)
Original mtime: (2008, 6, 29, 10, 15, 5)
Duration 0.00167894363403
Stop 10:15:07
------------------------------
Start 10:15:08
ZIP stored mtime: (2008, 6, 29, 10, 15, 4)
Original mtime: (2008, 6, 29, 10, 15, 5)
Duration 0.00195598602295
Stop 10:15:08
------------------------------
Start 10:15:09
ZIP stored mtime: (2008, 6, 29, 10, 15, 4)
Original mtime: (2008, 6, 29, 10, 15, 5)
Duration 0.0136680603027
Stop 10:15:09
------------------------------
Start 10:15:10
ZIP stored mtime: (2008, 6, 29, 10, 15, 4)
Original mtime: (2008, 6, 29, 10, 15, 5)
Duration 0.00206613540649
Stop 10:15:10
------------------------------
Start 10:15:11
ZIP stored mtime: (2008, 6, 29, 10, 15, 4)
Original mtime: (2008, 6, 29, 10, 15, 5)
Duration 0.00191879272461
Stop 10:15:11
------------------------------
Start 10:15:12
ZIP stored mtime: (2008, 6, 29, 10, 15, 4)
Original mtime: (2008, 6, 29, 10, 15, 5)
Duration 0.00196504592896
Stop 10:15:12
------------------------------
Start 10:15:13
ZIP stored mtime: (2008, 6, 29, 10, 15, 4)
Original mtime: (2008, 6, 29, 10, 15, 5)
Duration 0.00182104110718
Stop 10:15:13
------------------------------
Start 10:15:14
ZIP stored mtime: (2008, 6, 29, 10, 15, 4)
Original mtime: (2008, 6, 29, 10, 15, 5)
Duration 0.0369889736176
Stop 10:15:14
------------------------------
msg68939 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-06-29 08:54
That's a limitation of the zip file format. It uses DOS time stamps,
which only support 5 bits for representing seconds. As a consequence,
within a minute, ZIP can only store even seconds.

If the number of seconds in the minute is odd on the file system, the
zipfile module rounds down to the previous even second.

Closing as "won't fix".
History
Date User Action Args
2008-06-29 08:54:15loewissetstatus: open -> closed
resolution: wont fix
messages: + msg68939
nosy: + loewis
2008-06-29 08:17:28pythonmeistersetfiles: + ziptest.py
messages: + msg68936
2008-06-29 08:09:06pythonmeistersetmessages: + msg68935
2008-06-29 08:08:31pythonmeistercreate