Make Python respond to Windows timezone changes

前端 未结 3 751
别那么骄傲
别那么骄傲 2020-12-10 15:33

When Python is running under Windows, time.localtime does not report the correct time if the timezone is changed during the life time of the Python instance. Under Linux, ti

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-10 15:59

    No, this can't be fixed without doing what you did. It is a bit absurd, but if you need the correct time zone in Windows and it has changed during the program's execution, it must be done.

    This probably isn't a bug (the documentation is very clear that the tzset() function is only available on Unix). It's more likely a weakness in Windows that prevents the Python programmers from implementing tzset() under it. You can make a request for a feature enhancement, but it's been this way since Python 2.3 (7 years), so it's unlikely it will actually get implemented.

提交回复
热议问题