invalid time - why ?

Thomas Guettler guettli at thomas-guettler.de
Tue Dec 9 10:39:39 EST 2003


Am Tue, 09 Dec 2003 15:14:51 +0100 schrieb fowlertraine:

> Hello python-list,
>     starttime=time.time()
>     .... process ....
>     endtime=time.time()
>     dtime=endtime-starttime
>     print "Started at:", time.strftime("%H:%M:%S",time.localtime(starttime))
>     print "Ended at:", time.strftime("%H:%M:%S",time.localtime(endtime))
>     #print time.localtime(dtime)
>     print "Deltatime: ", time.strftime("%H:%M:%S",time.localtime(dtime))

Python like most operating system use seconds since 1970 for storing the time.

If you do "endtime-startime" your result will surely by in the year 1970.

You could do:
print "Deltatime %s hours" % float(dtime)/(60*60)

 thomas






More information about the Python-list mailing list