> The short explaination of this issue is that the timestamp shown when > you do a dir on a file that is on an NTFS volume changes by an hour > when DST starts and also when DST ends, even though the file has NOT > been modified!!! Note that this only happens if you have the setting > turned on to automatically adjust for DST (this is the default in > Windows).
You are misinterpreting what you are seeing. Windows is not claiming that the modification time changes when DST starts. Instead, it is claiming that the *same* time now has a *different* textual representation, because the computer now has moved to a different time zone. When you explicitly change the time zone of your computer, you will notice that all file time stamps immediately change also. > Even though Python 2.5.1 is correct this presents a NEW problem > because it differs from what XP SP 2 (wrongly) reports. I am sure > this will cause a lot of confusion for people as it already appears > that others have stumbled on this difference. However, please understand that the problem is *not* caused by the results returned from os.stat. Instead, the difference comes from your choice of calling localtime() to break down the timestamp to day, hour, and minute. If you write a different function windows_localtime, that behaves the same way that the Windows rendering behaves, you will get the same results. > To the end user it appears the file was modifed when in fact it was > not. That's because the user is misinterpreting the data that Windows reports. Windows isn't saying the file changed, Windows says that the timezone changed. To understand this, you have to truly grasp the notion of absolute time. June 2, 2007, 9:40 is *not* a point in time. Instead, you have to provide a timezone also to make it point in time. So Windows is incorrect not giving the time zone; otherwise, it is correct. > This file was originally created 01/02/2007 12:00 AM GMT > which is the same locally as 01/01/2007 07:00 PM EST > but now everything EXCEPT Python 2.51 > is reporting that the file changed on 01/01/2007 08:00 PM EST Not true. Everything else is reporting that the time stamp is 01/01/2007 08:00 PM EDT (where EDT is the Eastern Daylight Time). > Having this difference between Python and Windows makes it difficult > to write code that depends on those values being in sync. No. Just write a windows_localtime function, and be done. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list