X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F2B6F39A045E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1623354756; bh=S22FNjxCUaNYeliX06uflyrMjZXITs7FHQ01rs79fwc=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=g3Cz6gb4WuyGsFaoPNKphrtXVMLznPbtubBpwrtiaS3CS55cf52NLy00sQYikO1SC pcKb9fxkfO5zHVuj3P6Tc/tYqlteInIhjeAKUA60BYRDeenXShxhHw1RpRjhjRQ5hx 1A+VmqJv48vNKGcBjAas9kfCyVXRlfMCtg1mbduQ= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8B0CD38515FF ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BA1SgLFJCUyxm9K329eyJAYVafQnHJT5JaelmYAOInv1rDil07ZD5EE8atIdY+YQhpYEIOTpXd0xYmBrmu4w4wSumGtAr+yOL6YNMYgZeGD4t9zItaNRH5XHKoABTouBNDADbPdTKXqESMOzMdCD1EuBwUOHKexAfKZTwQtKeaT+UoOsam8923OcDZrvMWNmvzby1JCGF4paEXb+7o5fO4O8mO+4nVQPJtiOabO33vkerzERYNc4C87Y3JFjVKh2t9Ptz77gE4E/tiasD+zvhhMcJJXwDK6C24g2cPt+lpuM23B3UR8EOBuyqlfh9zeiOTsT+Uv56Z+VbxTbwsLcfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WO/12q5KuvFSMCx+DrQUmgYABhSsRe1GG0SLzbaOVfk=; b=h3cIrlOfugz5w7pkSz3ZPjPMlW1w8VuvUq64E8/D4g16+FlOINXCodQXb67KZLRjhzRY1pL49DzMqSr1lGOwDqnHAShshB/UyfLAOVW/xeLyAI+O/hJkJGU7U5YH+7RhI+12640at6n+fGiGYgtjGAMA/yr/eLPSAuN2BHEfu0wNHImI7GbwKrMJ7wRhgaafg/+M6Nb35P4aHyX593ja6o75MMpGl6vwPk47niI+9rHS9DKcdF9iAQmwMQninO+qXJ/dLV8nXDaO7ALaiDUoAJx6FMrTwSlt+UFIyfac/dRLNy0kLPXtg4JGn1ibk8cHpsRMGlPQqhB8pV8BSyX9+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none Subject: Re: Python for Windows reports wrong local time when run under Cygwin on Europe/Moscow TZ To: cygwin AT cygwin DOT com References: <02d5b40f-aa35-f56c-5c5c-b10780355e91 AT SystematicSw DOT ab DOT ca> <0fcfeb54-53c5-b83d-bb13-e83a68eed469 AT cornell DOT edu> <28d9253d-71f4-c265-2861-9a3b0667799b AT SystematicSw DOT ab DOT ca> Message-ID: Date: Thu, 10 Jun 2021 15:50:12 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: <28d9253d-71f4-c265-2861-9a3b0667799b@SystematicSw.ab.ca> Content-Language: en-US X-Originating-IP: [24.194.34.31] X-ClientProxiedBy: CH2PR05CA0062.namprd05.prod.outlook.com (2603:10b6:610:38::39) To BN7PR04MB4388.namprd04.prod.outlook.com (2603:10b6:406:f8::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.18] (24.194.34.31) by CH2PR05CA0062.namprd05.prod.outlook.com (2603:10b6:610:38::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.9 via Frontend Transport; Thu, 10 Jun 2021 19:50:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97c8fbf8-40b3-4676-25b0-08d92c490fc3 X-MS-TrafficTypeDiagnostic: BN7PR04MB3844: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vr+LqEMH64WKW+972JFOEitEBxoGtZJ9G+yEiv+q75KnMyI/1d0IaRNaxG7ok4dbdbErgapromk60+HaSSS0g3eJDxHUxMA8cbZP1k8aWR4tlqXDZnDeaBcypUgu1CE+PtFhxQ853CtSBUFyyA5Wnig3QI5N3omLZROrIhAezfLacoBMUJkEbOlzDJ9Rmr6tecVPAG7EvTsbHiXLXaKH15x8cEipDWKQ4Kiw8IZ06cpQ9zt76me+61rvxoihAjWoyzCFq2scZ7OTaqmz+STH484gDs/RHjVb6lTB14crGxtC+zg4mbXXDvpdVzINhJK3rBPmUKeUPcgt2Kt0kIa2ClvleR4RW6cyCyjsYU+xUeFALnor6K4eBRcAfeQbdlnFnTciFZf5+im77ZYuMPrqSVWS3f+iyWPX18EgyiBH/ujiXWoVIkGfOGjS1YLkO0W8MsOxUWaRSA6S3kS3glkwX9hcxlEr9a6pPWKRUo38yb5GJR6DV55gRTcA0P6Ovi4AoAx+EkccySPHZrZJui9fqdThQFdVQCw8+u+uXlSKhVniqo5dynV05oTWrzpfLlL3dYBcJvFTvi/If02eV218UnpO0ffBicoCQrL0KSX0aoxUUK5auVpk4SRzIwghhga2GeCMqShZ7Ic4eq4zf0vqQ1MOs6SWXKUdcpa0DyrEFDc1agKRcZZnDPUOzhPsHS2ShdBHww5XnMetwSqsyWBmMC3fQaxJ/6TyFNVrTF5VgDhRHKGQf/0lcNn4NqkVMGeEw9xiPg9IC0Ir8H/u3Ad0Fb89AABlQ/g6lbuKweEVmLyiPLLykPv/wWbKSaU64+y9Kdz9BW0u4DdTCha7tXgpDQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN7PR04MB4388.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(396003)(376002)(346002)(366004)(31686004)(66556008)(53546011)(6666004)(6486002)(16576012)(316002)(5660300002)(8676002)(186003)(66946007)(26005)(31696002)(786003)(966005)(83380400001)(36756003)(2906002)(8936002)(956004)(16526019)(75432002)(478600001)(2616005)(86362001)(38100700002)(6916009)(66476007)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?Windows-1252?Q?h4bZ9VmxmIrEwiG84OS/gT7V6cKpf1//XAXOPHrdil1KggkXarH8mqab?= =?Windows-1252?Q?6IEdpKrYFc7RqVUpcSBqFNATQbS6cnCiPwfdG4tjuj6vL+Do8y8hTzvw?= =?Windows-1252?Q?szMTk+IN6+mAB/CB80YNUgYJ+vs5D/GaPSIimJ2cRsJ1og0z9TKfO7ns?= =?Windows-1252?Q?M8gbrzGRbDvawkgBVIdT6Kh3zLH7N7keSMxzDE8g+Ng/8LGwLpAdLLLi?= =?Windows-1252?Q?foha1YFmd97f/3sViPxQZzsLwZX6AhbjTczne+TVPUssS+TTJS7ucZG8?= =?Windows-1252?Q?cGL21RSePiqRgydZUQEQdnqW+Mrf7l9NuduaqxyQwOZUMZia/ddihKFq?= =?Windows-1252?Q?59XC6JMkuGNggnPfRpfYjY3oQGpXkcMwESRAHOJ61JDG/EJ5EuKZZB9g?= =?Windows-1252?Q?AH4mlwfglNg/Vh5uEzNf1EA4wSn5AYkqX0U4+0rBKPLlrz98U4nnErWV?= =?Windows-1252?Q?GBIUxCc1wuXFlHV0ucPRIgzV+KIBQ5qJOHIeA5cHK1OJkNglnFZpDzaR?= =?Windows-1252?Q?zhTzRq4Py99mtUWbhxlAXRnKTBwVRcomtPzfcrHdsvRPxO6pOnpqPeJf?= =?Windows-1252?Q?CNFz2MDhtJYTm1vwBExBRLGsuBrs1eI2JshAazasjBl63cQfc/K2MfMM?= =?Windows-1252?Q?lpH8yZpN774mwFXS3hv5zccz3RmuYvGJrVlCPxXUPwcvEhLrmXgFiN7S?= =?Windows-1252?Q?e/nj9L3AC5+NN7fdPY2CL/6KqIbgplsfVisObn1eHjQs93bArZ/Y++Ci?= =?Windows-1252?Q?JpcOIfFbWHH1EaPHoj41qwxP3c+945qr92a8Ol4qcBqV4KOR/Ps5SubB?= =?Windows-1252?Q?ta7amsTf8cizlBb72hvmG//1cd88vcrxUFMZJXPuDCB7xHcBn548zkca?= =?Windows-1252?Q?asFy4fIQlX4E31FoMgX7MyH0+3s+0txKZz6c5lVubqNZ+7cGO077U1/5?= =?Windows-1252?Q?KnNl4EFVkoK/Av1LZRfFi4YENLW31+KfY5iTA1AU30XhuqXZpC98Cla9?= =?Windows-1252?Q?i9+07FsxdQGuWHPg3slptsc81qJ28g7abaDQLpRpJdhnrM0euv+6fr1Z?= =?Windows-1252?Q?y7Bo5Srtb7y+yj9XdyRlUAj9cZw0ln7FTvAWG4+VYL/jgSPvWRZvKjAK?= =?Windows-1252?Q?SoVEFZxftUDIqTqd7Qch9xLOkwc+ARxRigGNhm8J3zN651mrspeKuQO/?= =?Windows-1252?Q?HP5E0fjCOzPx8Tc7hli/Rxgg91e2VGHTXEmAjl3aK+OFMgXuv05Z/yYr?= =?Windows-1252?Q?RI0rBKjSmyfot0CxbEeEuys2vhsb4KsPPbZRnmVUR9G8vIPz5rA8kIIf?= =?Windows-1252?Q?io/peDO30MG4g7g6srCqXm1GRFd+UCQrwpXKqQZ6brOZ98NVW61uTyxD?= =?Windows-1252?Q?fYV72NvRuDi9qHrQhCwnoIhGdDjwVltUducZIYS7GXaDSSR6t9ZgYyZs?= X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 97c8fbf8-40b3-4676-25b0-08d92c490fc3 X-MS-Exchange-CrossTenant-AuthSource: BN7PR04MB4388.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2021 19:50:56.0646 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IAx+t7X1LHyHntMsSV4rsuFqdwBLxrCp2ArgvL4rvcm1IaIM1b68CJbjT3LJ4x00xJD5n2Fvuq6K/KeSEoqhhg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR04MB3844 X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Ken Brown via Cygwin Reply-To: Ken Brown Content-Type: text/plain; charset="windows-1252"; Format="flowed" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 15AJqaeO017154 On 6/10/2021 2:31 PM, Brian Inglis wrote: > On 2021-06-10 08:57, Ken Brown via Cygwin wrote: >> On 6/9/2021 10:36 PM, Brian Inglis wrote: >>> On 2021-06-09 16:31, Keith Thompson via Cygwin wrote: >>>> [Sorry if the threading is messed up.  I don't subscribe, so I'm >>>> constructing this message from the web interface.  It should at least >>>> show up under the correct subject.] >>>> >>>> Brian Inglis wrote: >>>>> 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. >>>> >>>> Summary: IMHO Cygwin should adapt its default TZ setting to work >>>> with Windows. >>>> >>>> The suggestion is to modify Python for Windows so it can deal with >>>> the TZ format used by Cygwin.  I haven't used Python for Windows, but >>>> as far as I know it's unrelated to Cygwin; rather it, like Cygwin, is >>>> intended to work on top of Windows.  I'm not convinced it's appropriate >>>> to ask Python for Windows to make a change purely for the sake of >>>> interoperating with Cygwin, which many PfW users presumably aren't >>>> even using. >>>> >>>> I've run into another application that has problems with Cygwin's >>>> settings of $TZ.  It was a internal test application that isn't >>>> going to change its timezone handling just for this problem. >>>> >>>> The ideal solution would be for Windows to recognize TZ values like >>>> "America/Los_Angeles", but that's not likely to happen any time soon. >>>> >>>> My suggestion, since Cygwin is supposed to interoperate with Windows, >>>> is one of the following: >>>> >>>> - Cygwin should avoid setting TZ to a value that Windows doesn't recognize >>>>    (if I set TZ=PST8PDT, everything seems to work correctly); OR >>>> >>>> - Cygwin shouldn't set TZ at all by default.  (I've updated my >>>>    $HOME/.bash_profile on Cygwin to unset TZ, and Cygwin commands seem >>>>    to work correctly with TZ unset); OR >>>> >>>> - Cygwin, when invoking a non-Cygwin executable, should first either >>>>    unset TZ or translate it to a format that Windows will recognize. >>>>    I have no idea how difficult that would be. >>> >>> Impossible to set Windows TZ usefully as it obeys unstated US DST rules (like >>> posixrules, perhaps 2007+?), and may have limits on hour offset magnitudes. >>> MS libraries are stuck at POSIX 1996 and C 99 subset compatibility, but >>> non-standard-conformant including which headers contain definitions: >>> >>>      https://docs.microsoft.com/en-us/cpp/c-runtime-library/compatibility?view=msvc-160 >>> >>> >>> It may be possible to unset TZ when running non-Cygwin programs (possibly >>> behind a CYGWIN env var setting e.g. winnotz) by adding TZ= to conv_envvars, >>> and writing new helper functions env_tz_to_posix to call tzset and >>> env_tz_to_win32 to remove TZ in: >>> >>>      https://sourceware.org/git/?p=newlib-cygwin.git;f=winsup/cygwin/environ.cc;a=blob >>> >>> >>> What is the opinion on this from both Windows users and Cygwin patchers? >> >> I'm not convinced it's worth the trouble.  I haven't seen anyone argue that >> it's useful for Cygwin to set TZ, and I have seen an argument that it's harmful: >> >>    https://cygwin.com/pipermail/cygwin/2017-May/232675.html . >> >> So I prefer Keith's second suggestion: >> >>  >> - Cygwin shouldn't set TZ at all by default. > > It does so in default startup scripts Right, and I'm agreeing with Bruno (in the message cited above) that the default startup scripts should stop doing that. > to get the correct behaviour from Cygwin > DLL and programs, Can you be more specific? What goes wrong if TZ is not set? I haven't seen any POSIX or Linux documentation that says it should be set, and I've just checked on two different Linux distros that it's not set by default. Ken -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple