On Thu, Sep 6, 2012 at 4:25 AM, Ray Jones <crawlz...@gmail.com> wrote:
>
> Why the additional step of calling time.tzset()? Once os.environ['TZ']
> is set, I've found that time.localtime() responds to the new TZ without
> anything extra. Is that a difference in versions (2.7.3 here)?

It shouldn't strictly be necessary using glibc. I checked the source.
glibc localtime calls __tz_convert() on each call, which calls
tzset_internal() to update the TZ setting. However, I don't think
that's guaranteed in all C runtimes. As the Python docs say,
"[c]hanging the TZ environment variable without calling tzset *may*
change the local timezone used by methods such as localtime, but this
behaviour should not be relied on."
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to