Eryk Sun <eryk...@gmail.com> added the comment:

> 2. Execute 'set TZ=Europe/Moscow'

The Windows C runtime supports a simple format for the TZ environment variable, 
which is detailed in the documentation of _tzset() [1]. For example, it's 
"MSK-3" for Moscow Standard Time. It's -3 because the offset is from local time 
to UTC. 

The CRT does not verify that the TZ value is valid. "Europe/Moscow" is invalid, 
but it's blindly parsed anyway. There's no UTC offset, so it defaults to UTC (0 
offset). It's parsed as supporting daylight saving time, according to U.S. 
rules. Currently this corresponds to UTC + 1. That's why there's a -2 hour 
delta from Moscow Standard Time, which does not observe daylight saving time.

I recommend that you unset the TZ environment variable before running Windows 
Python. Use the system timezone.

---
[1] 
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tzset?view=msvc-160

----------
nosy: +eryksun

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44352>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to