problem with "time"

Jeff Epler jepler at unpythonic.net
Tue Mar 8 15:00:17 EST 2005


Without your code, it's hard to tell.

Here's a small program I wrote:
    import time

    t = time.time()
    print time.localtime(t - 86400)
    print time.localtime(t)
on both lines, the tm_isdst flag is the same.

If I choose two times that are on either side of the DST change in
my timezone, I get different answers:
    import time
     
    t = time.time()
    print time.localtime(t)
    print time.localtime(t+86400 * 90)
Here, I get different values for tm_isdst because DST is in effect for
one of the times but not the other.

> I have _no_ idea on how localtime() could reasonably synthesize
> different values for that flag for _any_ time value converted in about
> the same millisecond. What gives?

The tm_isdst field is not about the DSTness at the time of
conversion---it's about the DSTness of the converted time.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050308/5610efb3/attachment.sig>


More information about the Python-list mailing list