X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B44A73955406 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1623337222; bh=i8AovQiRrI3/sHGW263kM9WMqvRGigOPSjLbtZiPJtU=; 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=tgXU1U5oubA2PItoDJRg97HL26GNbnr5sauFuM/JC9pkvewH27OJt08y87zpopW+n oe4cgR7d3l9ZyFZFUJXnFhTHlOdN/4OjSpHPnxKPgdew+mK9F7HyTukfkYSIHH/vaL TQadAfhAIhQJtOEoMPURfyk9SuMfMxFoBExsq/pI= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6E50B384F012 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lO0XUVVOfzop2NEy8C2mekxLsIPj1Gdgbs76n6tnpWyaB7qFCbEckj19loSoZ4gNGJbKNWBhv9qyukjq+zwyoLzEj8L2S0rjlmA4xloOFokGtZWb2nNLrZMripRzvrJUq9F/eQP1g7RzWjTcfp7xliBImvUbyZLPbQOXbDjHBld4OCJ3YOtOvubwchppWqWdUrDDf2eseTuBAhdpple+8MUC/6vEzaPQAmNLtOd4JLznQPVuloTXVRZvLEr7R3lggNz1fQkdYaR043q7SaVFcrXvA/KW84WWVHxCQqqqJO8MhninRqGWHA6VpdwJhqu3rbyBl0ant570gcpoc8Vcjg== 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=77uSiwCCDudz1uh+xC3WLXE8XYURRQowN0EnjjWIrME=; b=IwOlWx4XyPqCDszdbe+I9JgyPNz4+yJpyUYKrMuaFhyMvHFlYS2uRepw8FxoPh6byt2RO1UeulcWwxXv2HVNB3E191OMB42UMc9j9eYi16dTz24YoGbZ8/GmFRvusjtwwBL8oaXgx52A7GkEv1i6VnS9a5792zomIhXt7cOWRI7F/nmDOQnzzyN+Z7FaD85X5mdskLqvEpnNrVlbiB9Gmmkp9tE1kWCTkfSKE8JFwjbkoEgJ2QUUyatmZmLG1uhD/WCkmswBysGx8op4Edcnk93ikQy4t0pWgA5FYq8Rd0pjTuaXCo3dxZdJ4fVVNWjCavwjqg5R926RzA5oZ7GkuQ== 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> Message-ID: <0fcfeb54-53c5-b83d-bb13-e83a68eed469@cornell.edu> Date: Thu, 10 Jun 2021 10:57:35 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: <02d5b40f-aa35-f56c-5c5c-b10780355e91@SystematicSw.ab.ca> Content-Language: en-US X-Originating-IP: [24.194.34.31] X-ClientProxiedBy: CH2PR16CA0016.namprd16.prod.outlook.com (2603:10b6:610:50::26) 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 CH2PR16CA0016.namprd16.prod.outlook.com (2603:10b6:610:50::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Thu, 10 Jun 2021 14:59:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0dc0b38d-dfba-491a-ea6f-08d92c204802 X-MS-TrafficTypeDiagnostic: BN6PR04MB0867: 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: mD6akAK5ii3yXpnNr9I9bVEvZ65zhLQC2FfcLI7SxFO9oHaXrCtH+Mn9MTHd53vW+j4gfm1piuQmS1h0M4Go/ACE1yz8WTq5bITF3mihVPmXQvb2aCePjRQY5pgIr+YSDj72EIK1+gJO94DTudq+hfm/v4qhm8rvx/yOoycpPrkr9uLEgxIMKg8MK22+qFaZmIkx66azRfXUveu8o6HIX1sD6hcG2B3LuzkDrrsjIMnnykYl36OQ6d3Dhm/gRwfqON4a6+dAzc352GyHIrmap9ZpH2d5RqZI0hklZ7WFI1f+J+UbZOCFw9tUocGJwOdlM6aniuOPhWa6kvI66KlezESaZNTqfGIzwZlpWmsY+E8zwgkvzAm17fuJQefl5u8aHMOCn3RAXgS1Ozidp5D4c/7QrhhWNI8m7X0sic2uAhBnNtYVGDPeegDsRtWk2A74m88SYKnE3h1fsygJ188rh1y21gDBkSbmVlrP3R9/nVqKfq2YUuYdLAAOZMNKBFSPT651n+EysrNnAsP+odG3oi2/p84+kxj27+jKBZKRt3N5mMR5UQE3qj7/8DaaYo+0ZVMjGwABbaWqlYmC2jlDHZOWDViLmwCTcGWPNnhDroTNQuuyK6VlE+uqWYxAJYjc6agfZv2eh1DuHytqbiXDfDP9v7W0PhIpmU3HGVadBhfSriCkQgxV8U+KTmwV0S9Xu7T5ry3eADYE/BbT3Rrb2y+KrTtmJsLCGE3d99Kt8Nmtom6U5xmzfcxt2r0JREFT01+mGPX+Oe7KFj1miKi1hMHoLV8pbobWYqDohgT1xmVsWgsPVTJqm8fl/H4Ir4GcQCiDzzO9tOnvpKoKcJZOwQ== 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)(366004)(26005)(16576012)(16526019)(186003)(66946007)(66476007)(2616005)(83380400001)(66556008)(31696002)(6486002)(8676002)(38100700002)(8936002)(86362001)(31686004)(75432002)(36756003)(53546011)(2906002)(6916009)(6666004)(966005)(5660300002)(956004)(498600001)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?Windows-1252?Q?EXvTZ7CJ0WJDBsCxLKH9PbN6A+R+fWjAIdbJuzMP7EQoFaJi0kYzusLT?= =?Windows-1252?Q?/6PxzckKCHhV7RArmiv+X2UvEXEGfyYXwCaKQb0HjnUokxUHQS3BXcnH?= =?Windows-1252?Q?Ct/1NIy/X+3wyM1ZL0Yd1YZLDBa2PhriN3MSs0otZHGST1YctW8C9Lez?= =?Windows-1252?Q?XIorLUk8LC3+5UmeoOVnUdqnJJIyP0jdpG1yv5EfeijbQ6KpfAFNuPyh?= =?Windows-1252?Q?7qaUDj01chkLEhOHRhrCs7mzMVMV1Uff1cioQnN1bHpOx8Y/UducmPRz?= =?Windows-1252?Q?HCvJimMMBvYFJZBeuI0y9TvXAprRBW7X1wHJOx61QB9U9Y4ub1zbdd1o?= =?Windows-1252?Q?UMwgVWdXBPmxecqrD5gNpl3BfzyO5yrczO6K+GzuZwd4qT0TVLC2vtFZ?= =?Windows-1252?Q?HBe4vPFoG9ZMkuICNfx1aAEIQ03tFzj6HIy2uAZDJh58G4blW7fPUUoX?= =?Windows-1252?Q?M19aoTstkBH0SZQXyGlsJmDDlvOBNQn8hPd8wUoNAS7DCiRyio3d8xzr?= =?Windows-1252?Q?m7jR1WuhZ/3z7UumffIG3ysE93wfWOnbR7QGqw5Gptgs7TBF1P17RbxT?= =?Windows-1252?Q?uIlNkMHEkqMursLt+Y0vqoC4hgIWYzkKIHkIOkVgg1+hCPiRyE49eT/8?= =?Windows-1252?Q?9DcHCwBDZdLr5PdUcBoBr4GRCdyuN161g3eBKx2HjOG1/+CW7ijUtI0w?= =?Windows-1252?Q?Vya3qRdLMYAN94ICM2Cfc4+Nzcs1mFbyqDcJc7tW3HNoJP/n3CyaZX2k?= =?Windows-1252?Q?3KTAvaVt54hTaa0nge8JS6rbadkAt7VPecAwuEJ5aw/uIvqoBYWRv5E/?= =?Windows-1252?Q?dyY9b2sZFSz8yTZ8yB/eE2dfFLGDaKS8ZSvgkiEn6xPwEEPNrUYDfMqC?= =?Windows-1252?Q?khqrXsxPS7QPw8P6Mp2rxggdMKiI0IRLpFhulCTphDzy7kcguK6E/mxm?= =?Windows-1252?Q?TfZ2O1eljdDwSxjfivC8VZF4PrGzVqm5MIDUNxs/B0at50+KgwZJDMRu?= =?Windows-1252?Q?kd62nZDY92Z7YLCyQ4OGDEiHG6JWXWscVET8Q5mezbCfgi2QB5c1R8V1?= =?Windows-1252?Q?UpxqHe1wR8jgkQvcqiBST0cGbcWxir+FeXDT1yyyB8N+IdB6+ppxknlu?= =?Windows-1252?Q?lY78XS9d8KpD52w4qHrmlT3uAl11TwxFMy672zVFcw/wFIUfOBcRj9c6?= =?Windows-1252?Q?6hsWn+BQ/9j+r6BL7S31QFuEyS2cR3AWwSx4+CDDQ7Oi569uMNN498tE?= =?Windows-1252?Q?R41nM6ACLSdFFd1oIAmyZxpptrYNjYOObsnotMCLDsPx82pVt2hWhHDb?= =?Windows-1252?Q?iiOUcMJlT3JcbRl1zEyV7Wz8Z+SctG/AGQo+ayWRrkWAXsqurxvRIZe8?= =?Windows-1252?Q?0t07A2okIAk5aiu8a4pEtMTqhO9f0HAK5r9Xbjt3WAyZ1hdeKkKkd58K?= X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 0dc0b38d-dfba-491a-ea6f-08d92c204802 X-MS-Exchange-CrossTenant-AuthSource: BN7PR04MB4388.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2021 14:59:01.0241 (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: vR//BW/RwfyHlWA7PrR3RxH77XNPp9mPRS1AmAJ5gJPAlu3Ump4TRCC2Jl3oeoJG/LaChxo/bDzcEvT0N+Rx3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR04MB0867 X-Spam-Status: No, score=0.5 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 15AF0Ofj027956 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. 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