title: Create a stopwatch (not a countdown or timer) without using Tk python
body: <p>I am trying to make a stopwatch function for my module. It is to record the time that my module is called to be imported to the time that it is fully imported. The reason I am trying to record this is because my module takes forever to load (Because it needs to compile data from external sources and combine this data into lists). Forever being about 90 seconds. I have looked up similar questions but it would simply be about creating countdowns or timers. I'm open to many options, as long as they utilize python's built-in modules. If there's already something out there like this, it would be great if you can tell me. Thanks in advance!</p>
  
  <p>If you need any more information, just leave a comment and I'll get back to you. :)</p>
  
  <p>EDIT:</p>
  
  <p>Taking into consideration MeetTitan's answer, I have made this test function to try this out:</p>
  
  <pre><code>def f():
      import time
      starttime = time.time()
      import tms # This is my module that takes forever to load
      print("Time Taken {}".format(int(time.clock() - starttime)))
  
  &gt;&gt;&gt; f()
  Loading module. This may take up to 60 seconds.
  Time taken -1419389848 # What does this mean?
  </code></pre>
  
  <p>Here's what it says in the Python Documentation:</p>
  
  <p>time.clock()</p>
  
  <p>On Unix, return the current processor time as a floating point number expressed in seconds. The precision, and in fact the very definition of the meaning of “processor time”, depends on that of the C function of the same name, but in any case, this is the function to use for benchmarking Python or timing algorithms.</p>
  
  <p>time.time()</p>
  
  <p>Return the time in seconds since the epoch as a floating point number. Note that even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second. While this function normally returns non-decreasing values, it can return a lower value than a previous call if the system clock has been set back between the two calls.</p>
  
  <p>Is the output number supposed to be negative? What's the real time that it had taken? I'm sorry if I'm asking too many questions...</p>
  
  <p>EDIT:</p>
  
  <p>I've got it.</p>
  
  <pre><code>def f():
      import time
      start time = time.time()
      import tms
      print("Time taken {}".format(int(time.clock() - starttime)))
  </code></pre>
  
  <p>Now, here's my last issue. How do I integrate it within my existing code so that when I type in this:</p>
  
  <pre><code>&gt;&gt;&gt; import tms
  Loading module. This may take up to 60 seconds. # after 30 seconds...
  Time taken 31.49 seconds
  </code></pre>
  
  <p>this is the beginning of my code:</p>
  
  <pre><code>import os, sys, time
  
  # Does the code go somewhere here? How would I implement it?
  
  print("Loading module. This may take up to 60 seconds.
  
  tmlist = []
  alltmlist = []
  gen1tmlist = []
  gen2tmlist = []
  </code></pre>
  
  <p>I've made a follow-up question in hope of my "ideas" getting out more effectively. Click <a href="https://stackoverflow.com/questions/27639658/record-time-taken-to-import-module">here</a>.</p>