what's the fastest way of converting a string time stamp into epoch time with python?
<p>I need to do lots of conversation from string time stamp like '2012-09-08 12:23:33' into a seconds which is based on epoch time.Then i need to get time gap between two timestamp.I tried two different ways:</p>

<pre><code>date1 = '2012-09-08'
time2 = '12:23:33'
timelist1 = map(int, date1.split('-') + time1.split(':'))

date2 = '2012-09-08'
time2 = '12:23:33'
timelist2 = map(int, date2.split('-') + time2.split(':'))
delta = datetime.datetime(*timelist2) - datetime.datetime(*timelist1)
print delta.seconds
</code></pre>

<p>The second way is:</p>

<pre><code>date1 = '2012-09-08'
time1 = '12:23:33'
d1 = datetime.datetime.strptime(date1 + ' ' + time1, "%Y-%m-%d %H:%M:%S")
seconds1 = time.mktime(d1.timetuple())
....
seconds2 = time.mktime(d2.timetuple())
print seconds2-deconds1
</code></pre>

<p>However these two ways are not fast enough because I have almost 100 millions actions to do.Any suggestion?</p>
