updated version of David Ascher's compile.py?
gangli at msn.com
gangli at msn.com
Tue Aug 29 13:02:45 EDT 2000
In article <bSCq5.21671$Xg.142292 at news-server.bigpond.net.au>,
"Mark Hammond" <MarkH at ActiveState.com> wrote:
> > >>> import os, time, win32api
> > >>> fname = 'D:/python/pythonwin/pythonwin.txt'
> > >>> fobj = win32api.FindFiles(fname)[0]
> > >>> w_last_f_time = fobj[3]
> > >>> w_last_f_time.Format()
> > '05/03/99 22:23:16'
> > >>> last_time = os.path.getmtime(fname)
> > >>> time.localtime(last_time)
> > (1999, 5, 3, 17, 23, 16, 0, 123, 1)
>
> This looks correct to me. The Win32 documentation states:
> "FindFirstFile and FindNextFile report file times in Coordinated
> Universal Time (UTC) format."
>
> And this is what it looks like is happening. If you change the last
> line quoted to give you the UTC time of the file, you should find they
> agree.
>
> Mark.
I agree that PyTime.Format consists with result of time.gmtime. But
time returned from PyTime.__int__ is not consists with Python time
module. You may put the fact into win32 help file. (see example below)
PythonWin 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on
win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
Portions Copyright 1994-2000 Mark Hammond (MHammond at skippinet.com.au)
>>> import os, time, win32api
>>> fname = 'D:/python/pythonwin/pythonwin.txt'
>>> last_time = os.path.getmtime(fname)
>>> time.localtime(last_time)
(1999, 5, 3, 17, 23, 16, 0, 123, 1)
>>> fobj = win32api.FindFiles(fname)[0]
>>> w_last_f_time = fobj[3]
>>> w_last_f_time.Format()
'05/03/99 22:23:16'
>>> time.gmtime(last_time)
(1999, 5, 3, 22, 23, 16, 0, 123, 0) <-- same as above
>>> time.gmtime(int(w_last_f_time))
(1999, 5, 4, 3, 23, 16, 1, 124, 0) <-- wrong
>>> time.localtime(int(w_last_f_time))
(1999, 5, 3, 22, 23, 16, 0, 123, 1) <-- wrong again
>>>
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list