converting a timezone-less datetime to seconds since the epoch

Floris Bruynooghe floris.bruynooghe at gmail.com
Wed Apr 7 08:38:14 EDT 2010


On Apr 7, 9:57 am, Chris Withers <ch... at simplistix.co.uk> wrote:
> Chris Rebert wrote:
> > To convert from struct_time in ***UTC***
> > to seconds since the epoch
> > use calendar.timegm()
>
> ...and really, wtf is timegm doing in calendar rather than in time? ;-)

You're not alone in finding this strange: http://bugs.python.org/issue6280

(the short apologetic reason is that timegm is written in python
rather the C)

Regards
Floris



More information about the Python-list mailing list