Python 2.5.1 broken os.stat module

"Martin v. Löwis" martin at v.loewis.de
Fri Jun 1 06:56:34 CEST 2007


> I created a file and specifically set the created date, last accessed date 
> and last write date to
> 
>     01/02/2003 12:34:56

How did you do that?

> In the case of my above test I know exactly what the timestamp on the file 
> is because I manually set it so that all 3 timestamps are the same.
> Since Python 2.5.1 does not return the known values for that files 
> timestamps how can it not be a Python 2.5.1 bug?

The program you've been using to set the time stamp to the old date
may not be working correctly.

> Further testing shows that the results are somewhat inconsistent, many times 
> the create and access date are correct but the Last Write timestamp is 
> wrong.  It is generally off by one hour but I have seen situations where it 
> was +1 hour and other situations where it was -1 hour.

In these cases, always ask yourself whether the time-zone of that time
stamp is different from the current time zone. In particular, did
these old time stamps live in non-DST, and the current time zone is
a DST one?

> I even found situations where the python timestamp was 1 minute later.  (I 
> know about the 2 second timestamps on FAT, all my filesystems are NTFS).  I 
> just found a situation where the python timestamp was 02:51 PM and the 
> windows timestamp was 02:12 PM.   DST or timezone changes are not going to 
> make the results be off by 39 minutes?   (My timezone is GMT - 5:00).

Right. If that is reproducable, it is a bug. Please create a zip file
containing this file, and submit a bug report to sf.net/projects/python.

Regards,
Martin



More information about the Python-list mailing list