Time Problem

Lemniscate d_blade8 at hotmail.com
Fri Nov 22 13:35:12 EST 2002


Okay, I seem to have an issue with the time.ctime function. 
Specifically, I don't understand the hour entry in the tuple.  It is
supposed to match the hour of the day (in the second example below, it
is in the 10 am hour, so the hour element in the tuple above is 10,
however, using 923611182 as the number of seconds, I get the results
as below.  Why is the time showing up as 15:39???  It should be 22:39,
right?  In fact, this example is taken from Chapter 9 of the Python
Programming  on Win32  book (ch.9, pp 146).  Not only that, but the
picture on 147 shows that the time should be 23:39 on 08/04/99 (which
is NOT what the ctime function returns.  Am I doing something wrong (I
hope not) or is this something with the time module (I hope not even
more).  Please, I need to use this kind of information but I'm not too
sure if it is reliable.  Could somebody tell me what I am doing wrong?
 Thanks a bunch,

Lem

PythonWin 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on
win32.
Portions Copyright 1994-2001 Mark Hammond (mhammond at skippinet.com.au)
- see 'Help/About PythonWin' for further copyright information.
>>> time.ctime(923611182)
'Thu Apr 08 15:39:42 1999'
>>> time.gmtime(923611182)
(1999, 4, 8, 22, 39, 42, 3, 98, 0)
>>> time.localtime()
(2002, 11, 22, 10, 21, 13, 4, 326, 0)
>>> time.ctime()
'Fri Nov 22 10:21:13 2002'



More information about the Python-list mailing list