Bugs item #3420417, was opened at 2011-10-07 12:21
Message generated for change (Comment added) made by mhammond
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3420417&group_id=78018
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: win32
Group: None
>Status: Closed
>Resolution: Wont Fix
Priority: 6
Private: No
Submitted By: Caleb Constantine (calconst)
Assigned to: Nobody/Anonymous (nobody)
Summary: PyTime value returned from FindFilesIterator is incorrect
Initial Comment:
The PyTime value in the WIN32_FIND_DATA object returned from FindFilesIterator() is incorrect. Say fdata is an instance returned from FindFilesIterator(), then time.localtime(int(fdata[3])) returns the UTC time, not the local time.
To reproduce:
(1) Create a new text file, say C:\test.txt
(2) Observe the modification date.
(3) Run the script on the command line with the path to the file created in (1) as the argument, e.g. pytimebug.py C:\test.txt
(4) Observe local time printed on screen is incorrect; in fact it is the UTC time.
----------------------------------------------------------------------
>Comment By: Mark Hammond (mhammond)
Date: 2012-01-07 16:59
Message:
Yeah - like 2831327, I'm reluctant to fix this as it may break people
already working around it and it doesn't exist in py3k.
----------------------------------------------------------------------
Comment By: Caleb Constantine (calconst)
Date: 2011-10-07 13:09
Message:
It seems the PyTime value (returned from FindFilesIterator()) is offset
from the correct value by the value of the UTC offset. E.g, if I find the
UTC offset, and subtract this from the PyTime before converting to
localtime, I get the correct result:
utc_offset = (datetime.utcnow() -
datetime.now()).total_seconds()
ftime = time.localtime(int(finfo[3]) - utc_offset)
Now ftime is correct.
----------------------------------------------------------------------
Comment By: Caleb Constantine (calconst)
Date: 2011-10-07 12:29
Message:
This bug might be related to bug ID 2831327, "GetProcessTimes converts
wrongly to PyTime".
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3420417&group_id=78018
|