This is a way to tell if your timezone is currently in daylight savings time. (Hint: time.daylight doesn't do this)
1 | isdst = time.localtime()[-1] # localtime with no arg needs 2.1 or greater
|
I misunderstood time.daylight. Where I live (east coast USA), time.daylight is ALWAYS 1 (because this timezone has daylight savings time for part of the year)
Tags: sysadmin
Using the attribute name increases readability.
isdst = time.localtime().tm_isdst