title: Why does a date generated after another can appear to be before the previous one in Python?
body: <p>I got the following code</p>
  
  <pre><code>    timestamp = datetime.utcfromtimestamp(float(timestamp))
      now = datetime.utcnow()
  
      if now &lt; timestamp:
          return False
  </code></pre>
  
  <p>Sometimes, it returns <code>False</code>. But only sometimes.</p>
  
  <p>A <code>print</code> just at the condition check gives me this:</p>
  
  <pre><code>now 2013-02-28 18:02:57.015817
  timestamp 2013-02-28 18:02:57.020000
  </code></pre>
  
  <p>So it seems that the timestamp is playing "Back to the future" for a few milisecs.</p>
  
  <p>The timestamp is generated from a <code>(datetime.utcnow() - datetime(1970, 1, 1)).total_seconds()</code> in a previous call.</p>
  
  <p>I got this result a in unit test ran by py.test in a Django project on a recent Ubuntu.</p>
  
  <p>My current solution is to make everything a timestamp, tuncate the milisecs and compare. It's ok for me to do so. I'm just curious to understand why does this happen ?</p>