getmtime in 2.5 reports GMT instead of local time

Josef Dalcolmo Josef.Dalcolmo at gmx.net
Thu May 3 10:26:47 EDT 2007


Hello,

I have tried this only on Windows XP.

in Python 2.4 os.path.getmtime() used to return an integer representing
the local time.

in Python 2.5 os.path.getmtime() reports a float representing the GMT of the
file's modification time.

Since I could not find any documentation to this behavioural change, I am asking
here: was this change intentional? Is it going to stay? Windows reports
the same time for the file as Python 2.4 used to. So I am tempted to
call this a bug, but wanted some feedback from the developers,
before filing a bug report.


If you want to test this, make sure your local time differs from GMT,
then do:

import os, time
print time.ctime(os.path.getmtime('foo.txt'))

on a file foo.txt, once with Python 2.4 then with Python 2.5, 
and you should see what I mean.

- Josef





More information about the Python-list mailing list