time bug in Python 2.2(Windows)?

Tim Roberts timr at probo.com
Fri Aug 2 01:38:04 EDT 2002


vogell_75 at earthlink.net (Lucas Vogel) wrote:

>I am using the time module to convert the creation date of a file to a
>date format for comparison.
>
>The creation time of the file I am looking at is 3/19/2002 at 7:14:32
>PM.
>
>os.stat returns a tuple of:
> (33206, 0L, 4, 1, 0, 0, 2536L, 1028240652, 1016594072, 1016594072)
>
>calling time.ctime(1016594072) returns this tuple:
> (2002, 3, 20, 3, 14, 32, 2, 79, 0)

No, it doesn't.  time.ctime returns a string.  Did you actually call
gmtime?  Try using time.localtime instead.

>>> import time
>>> z = 1016594072
>>> print time.ctime(z)
Tue Mar 19 19:14:32 2002
>>> print time.gmtime(z)
(2002, 3, 20, 3, 14, 32, 2, 79, 0)
>>> print time.localtime(z)
(2002, 3, 19, 19, 14, 32, 1, 78, 0)
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list