title: Python - calendar.timegm() vs. time.mktime()
body: <p>I seem to have a hard time getting my head around this.</p>
  
  <p>What's the difference between <code>calendar.timegm()</code> and <code>time.mktime()</code>?</p>
  
  <p>Say I have a <code>datetime.datetime</code> with no tzinfo attached, shouldn't the two give the same output? Don't they both give the number of seconds between epoch and the date passed as a parameter? And since the date passed has no tzinfo, isn't that number of seconds the same?</p>
  
  <pre><code>&gt;&gt;&gt; import calendar
  &gt;&gt;&gt; import time
  &gt;&gt;&gt; import datetime
  &gt;&gt;&gt; d = datetime.datetime(2010, 10, 10)
  &gt;&gt;&gt; calendar.timegm(d.timetuple())
  1286668800
  &gt;&gt;&gt; time.mktime(d.timetuple())
  1286640000.0
  &gt;&gt;&gt; 
  </code></pre>