>> that you are mistaken: There is NO difference between the outcome >> of os.path.getmtime between Py2.5 and Py2.4. It always did return >> UTC, and always will. > > Different results are indeed obtained, as others have demonstrated > (other than the irrelevant float/int distinction). The following C > sample program illustrates:
Right. However, contrary to what the OP claimed, 2.4 does *not* return local time - it still returns UTC. It may just return "a different" UTC. > A key fact here, I believe, is that in February (when temp.txt was > last modified), my local time was UTC-11. I expect this is the > suffering that your comment in posixmodule.c refers to (it looks to me > like Python 2.5 is correct). In case there was any doubt: your tests show that 2.4 does not return local time. The output of dir matches the results of the time.ctime output, that must meant that the ctime input was UTC. Now, that there is a one-hour difference is an inherent problem with the FAT file system (so I assume you use FAT on your disk drive). FAT has an inherent problem with UTC file stamps, as the time stamps are stored in local time. So if you have an old time, you can only interpret it in a meaningful way by assuming that the machine was in the same time zone when the file was created as it is now. The the DST issue come in: should one assume that the DST switched since when the time stamp was created; depending on what you assume here, a one-hour difference will occur. IIRC (and I clearly didn't at the beginning of the thread): The MS CRT tries to adjust time stamps because of these problems, but does so incorrectly. In particular, it adjusts time stamps on NTFS volumes as well, which *are* in UTC. So even though the system reports the correct time stamp, the CRT will return the wrong one. Python 2.5 fixes this, bypassing the CRT. So yes: the time stamps returned in 2.4 and 2.5 may differ. But still: they were always UTC, and always will be. It's just that 2.4 had a bug which 2.5 has fixed. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list