time module error.

Des Small des.small at bristol.ac.uk
Thu Sep 13 10:21:48 EDT 2001


Yow!

I want to have a time class, with instances I can add to in hours.
Rather than reinvent the wheel, I want to use the standard time
module, but as the transcript below shows, I have trouble.

==========8<==============================================
Python 2.1 (#1, May  3 2001, 12:58:02) 
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import time
>>> t = time.strptime( '2',"%H")
>>> t
(1900, 1, 0, 2, 0, 0, 6, 1, 0)
>>> time.mktime(t)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OverflowError: mktime argument out of range
===========8<==============================================

Now, I can easily enough convert hours to seconds in my own code, but
I don't understand why the above fails.  

Any pointers?

Des.
-- 
Dr Des Small, Scientific Programmer,
School of Mathematics, University of Bristol,
Tel: 0117 9287984



More information about the Python-list mailing list