Can I trust mktime ?

Tim Howarth tim at worthy.demon.co.uk
Sat Dec 22 16:12:58 EST 2001


To find the date in 4 months time I've added to the months element of a
list copy of a localtime tuple.

(Which obvioulsy means months can be >12.)

Is converting this to a time() value with mktime then reading back with
localtime() considered correct/safe ?

All I know is it seems to work, I'd rather not load something like
mxDateTime as it's a simple task.


now=time.localtime(time.time())
print  now

then=list(now)
then[1]+=4

then=time.mktime(then)
then=time.localtime(then)

print then


-- 
___
 |im    ---- ARM Powered ----



More information about the Python-list mailing list