Python for Windows reports wrong local time when run under Cygwin on Europe/Moscow TZ

Brian Inglis Brian.Inglis@SystematicSw.ab.ca
Wed Jun 9 05:50:12 GMT 2021


On 2021-06-08 14:03, Mike Kaganski via Cygwin wrote:
> On 08.06.2021 16:04, L A Walsh wrote:
>> You might ask on a python list if anyone else has experienced
>> something similar with python or any other program.  I'm fairly sure
>> that neither MS nor cygwin design their OS with python in mind and
>> that it is python that is interacting funny when running under some
>> merge of both.  Have you asked the python people about this problem?
>> What did they suggest? 
> 
> FTR: filed https://bugs.python.org/issue44352.

See Keith Thompson subthread and my reply with suggested fix:

	https://cygwin.com/pipermail/cygwin/2021-June/248692.html

Windows does not recognize zoneinfo time zone identifiers in TZ only 
base format POSIX TZ strings with three alphabetic character identifiers:

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

That assumes US switch date "rules": for all years up to current, or 
just DST, and whether pre- or post-2007 is unstated!

Otherwise it defaults to regional settings, used by Cygwin to map to 
zoneinfo time zone identifiers, so if Python for Windows could clear TZ 
before it is read by MSVCRT, it should DTRT.

Windows does not recognize expanded POSIX TZ format strings with <> 
quoted alphanumeric characters, "-", "+", and start and end dates/times:

	https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#bottom

which make them usable outside of the US.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]


More information about the Cygwin mailing list