mktime (1.5 vs 2.2.1)

morden morden at shadows.net
Fri Mar 28 17:24:25 EST 2003


This function worked just fine in 1.5:

def gethourticks(runhour, now):
         year, month, day, hour, minute, second, weekday, jday, dsf = \
                 time.localtime(now)

         res = time.mktime( year, month, day, runhour, 0, 0,
                 weekday, jday, dsf )
         if( res < now ):
                 res = res + 86400 # seconds/day
         return res


With 2.2 interpreter I get this traceback:

Traceback (most recent call last):
...
blahblah
...
TypeError: mktime() takes exactly 1 argument (9 given)

My question is: what is a good way to get the code working on _both_ 1.5 
and 2.2?
Is there a builtin variable telling you the python interpreter version?





More information about the Python-list mailing list