Bug in Time module, or in my understanding?

Joshua J. Kugler joshua at eeinternet.com
Thu Aug 2 01:08:36 CEST 2007


On Wednesday 01 August 2007 14:45, Paul Boddie wrote:
> Well, I think that if you inspect the result of strptime, you'll see
> that the last element of the time "tuple" - in fact, the tm_isdst
> member of a time "structure" - is set to -1:
> 
>>>> time.strptime('2007-03-11 02:00:00', '%Y-%m-%d %H:%M:%S')
> (2007, 3, 11, 2, 0, 0, 6, 70, -1)
>>>> time.strptime('2007-03-11 03:00:00', '%Y-%m-%d %H:%M:%S')
> (2007, 3, 11, 3, 0, 0, 6, 70, -1)
> 
> What is likely to happen when such results are passed to mktime is
> that the underlying library function will use its discretion in
> determining whether daylight savings time is in operation or not.

That sounds about right.

> By asserting tm_isdst as being 0, the usual apparent interval between
> the times is preserved.

I'll do that.  This isn't so much about DST vs. non-DST (as I may be putting
values in here that were recorded during DST), but in this case it was just
trying to get the same value out that I had put in.

Thanks for the pointers!

j

-- 
Joshua Kugler
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/  ID 0xDB26D7CE




More information about the Python-list mailing list