Jean Johnson wrote:

> I have a start and end time that is written using the
> following:
>
> time.strftime("%b %d %Y  %H:%M:%S")
>
> How do I calculate the elapsed time?

import time

FORMAT = "%b %d %Y  %H:%M:%S"

t1 = time.strftime(FORMAT)
print t1

time.sleep(1)

t2 = time.strftime(FORMAT)
print t2

# later

s1 = time.mktime(time.strptime(t1, FORMAT))
s2 = time.mktime(time.strptime(t2, FORMAT))

print s2 - s1

</F> 



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to