title: How to find running time of a thread in Python
body: <p>I have a multi-threaded SMTP server. Each thread takes care of one client. I need to set a timeout value of 10 seconds on each server thread to terminate dormant or misbehaving clients.<br>
  I have used the <code>time.time()</code>, to find the start time and my checkpoint time and the difference gives the running time. But I believe it gives the system time and not the time this thread was running.<br>
  Is there a Thread local timer API in Python ?  </p>
  
  <pre><code>   import threading
     stop = 0
  
     def hello():
       stop = 1
  
     t=threading.Timer(10,hello)
     t.start()
     while stop != 1:
        print stop
     print "stop changed"
  </code></pre>
  
  <p>This prints 0 (initial stop) in a loop and does not come out of the while loop.</p>