title: Cross-platform high-accuracy time in python
body: <p>I'm writing a game that should run on several platforms.  I need a good time accuracy on all platforms.</p>
  
  <p>I am not interested in knowing the time of the day, what matters to me is the elapsed time between two calls.</p>
  
  <p>After reading the docs, time.time appears better on Linux and time.clock better on Windows.
  I thought of writing something like this:</p>
  
  <pre><code>import os
  import time
  __all__ = ['hrtime']
  
  platform = os.name
  if platform == 'posix':
      hrtime = time.time
  elif platform == 'nt':
      hrtime = time.clock
  else:
      # 'os2', 'ce', 'java', 'riscos'
      raise ValueError("I have no idea what I'm doing.")
  </code></pre>
  
  <p>But what about the other platforms?  Does MacOS return {posix}?  What about cygwin, is that a Linux or a Windows?  What is 'ce'?  Should I even care about these platforms at all?</p>
  
  <p>Another option could be to use the SDL time from pygame.  This seems to have a millisecond accuracy on every platform.  Since I'm using SDL for the rendering I don't mind using that.  However, I am working on network code now, and using the SDL time in my network code feels a bit strange.</p>
  
  <p>Question: what would you rather use, and why?</p>