Python 3.1.2
Windows XP SP3
I am running into a problem with some files and their timestamps in python. I have a bunch of files in a directory that I received from an external source. It's not every file I am having a problem with but for some files python is showing an hour difference from what explorer or cmd show in XP. I am specifically seeing this problem when using the zipfile module in which after a file is zipped the "date modified" timestamp is changed to what python interprets it as, shown below.
CMD - before zipping
C:\forms>dir /T:W "C:\forms\7aihy56.fmx"
02/02/2007 12:50 PM 195,148 7aihy56.fmx
1 File(s) 195,148 bytes
0 Dir(s) 985,520,533,504 bytes free
Python - get mtime ctime
>>>import os
>>>st = os.stat("C:\\forms\\7aihy56.fmx")
>>>print(time.asctime(time.localtime(st[8])))
>>>print(time.asctime(time.localtime(st[9])))
Fri Feb 02 11:50:24 2007
Fri Feb 02 11:50:24 2007
List contents of zip file after zipping using python zipfile module
>>>import datetime
>>>import zipfile
>>>zf = zipfile.ZipFile("C:\\daily_forms_auto_backup.zip")
>>>for info in zf.infolist():
>>> print(info.filename)
>>> print('\tModified:\t', datetime.datetime(*info.date_time))
>>> print
forms/7aihy56.fmx
Modified: 2007-02-02 11:50:24
CMD - after extracting from zip file
C:\forms>dir /T:W "C:\forms\7aihy56.fmx"
02/02/2007 11:50 AM 195,148 7aihy56.fmx
1 File(s) 195,148 bytes
0 Dir(s) 984,923,164,672 bytes free