getmtime differs between Py2.5 and Py2.4

John Machin sjmachin at lexicon.net
Mon May 7 19:32:14 EDT 2007


On May 8, 3:26 am, Josef Dalcolmo <dalco... at vh-s.de> wrote:
> I tried this on Windows only:
>
> In Python 2.4 os.path.getmtime returned the local time,
> in Python 2.5 it seems to return GMT:
>
> import os, time
> print ctime.time(os.path.getmtime(foo))

I think you mean time.ctime :-)


>
> differs on Python 2.4 and Python 2.5 by the timezone.
>

You have presented no evidence. Did you read my reply to your previous
post?

> Is this a bug?

Is what a bug?

My timezone is *TEN* hours away from UTC. Here's what I get [Windows
XP Pro SP2]:

C:\junk>dir newfile.txt
 Volume in drive C has no label.
 Volume Serial Number is 7D12-D6D2

 Directory of C:\junk

08/05/2007  09:17 AM                 0 newfile.txt
               1 File(s)              0 bytes
               0 Dir(s)  44,508,061,696 bytes free

C:\junk>for %v in (4,5) do \python2%v\python -c "import os, time, sys;
print sys
.version, time.ctime(float(os.path.getmtime('C:\\junk\
\newfile.txt')))"

C:\junk>\python24\python -c "import os, time, sys; print sys.version,
time.ctime
(float(os.path.getmtime('C:\\junk\\newfile.txt')))"
2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] Tue May
08 09:17:
12 2007

C:\junk>\python25\python -c "import os, time, sys; print sys.version,
time.ctime
(float(os.path.getmtime('C:\\junk\\newfile.txt')))"
2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)]
Tue May 08
 09:17:12 2007

C:\junk>

To avoid bandwidth waste, I've omitted similar results for Python 2.1,
2.2, and 2.3.




More information about the Python-list mailing list