From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp16.mail.ru (smtp16.mail.ru [94.100.176.153]) by sourceware.org (Postfix) with ESMTPS id A0C70384B110 for ; Fri, 11 Jun 2021 06:01:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A0C70384B110 Received: by smtp16.mail.ru with esmtpa (envelope-from ) id 1lraEC-0007IH-PF; Fri, 11 Jun 2021 09:01:13 +0300 Subject: Re: Python for Windows reports wrong local time when run under Cygwin on Europe/Moscow TZ To: L A Walsh , "cygwin@cygwin.com" References: <5542c19d-8b1a-1f28-2003-fe9493ee9b56@mail.ru> <60BF5677.9060904@tlinx.org> From: Mike Kaganski Message-ID: <3aceb09c-98c4-0bed-d0a2-76bb9eabdccf@mail.ru> Date: Fri, 11 Jun 2021 09:01:10 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <60BF5677.9060904@tlinx.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C54EECC50CDFE52CD8E09EC742E3E75A787182A05F5380850408D167CA1A81D3B441537A1BC7F72C1DBA7C84EEA568167382E33A3C56B8694FE X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F9D3BE5B596754B8C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE789805A6418246A1AEA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BD6CF32B5F8F9D40434EA87E5CA1451179675E0E0DFE3F8B820879F7C8C5043D14489FFFB0AA5F4BF176DF2183F8FC7C0C3028DD3BA98ABD38941B15DA834481FA18204E546F3947CD2DCF9CF1F528DBCF6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F7900637028599BB38096F4F389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F7900637657FCFBDA3D277C6D81D268191BDAD3DBD4B6F7A4D31EC0BEA7A3FFF5B025636D81D268191BDAD3D78DA827A17800CE7403D0D5E9DD61F6CCD04E86FAF290E2D7E9C4E3C761E06A71DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B69DC5D3EDC80DC730089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24209795067102C07E8F7B195E1C9783109B94252949504FC1D9CBE3238DE1566 X-C1DE0DAB: 0D63561A33F958A5421C22ABEBD8353ABAC53BE2071AE6EDEFAE26A50EFB3F68D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA751867DA2D1EE5D15D410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34C75F910DBB8BE8984BC58CAC8F2688ACEB4173CA4489705E346208167DB3811450DB8020781B44E51D7E09C32AA3244C87A5D1E2F0AA350366FF46B34B72D09F35DA7DC5AF9B58C0729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojCpYK6nkTlbEn6UHAbRoMDQ== X-Mailru-Sender: 00097D31F91C944B962E58D352881757870EC1D59C600AF1367A92CB9523CAC7DA61A4E7F7D048568D3DB682BF6F1158E66B5C1DBFD5D09D046C2275A8D60F931CD745D6427E807167EA787935ED9F1B X-Mras: Ok X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham 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@cygwin.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: , X-List-Received-Date: Fri, 11 Jun 2021 06:01:16 -0000 On 08.06.2021 14:37, L A Walsh wrote: > On 2021/06/06 23:59, Mike Kaganski via Cygwin wrote: >> Hello, >> >> Running Cygwin 3.1.7-1 on Windows 10 Version 21H1 (OS Build >> 19043.985), I have this issue: >> >> when I start Cygwin's Python, I have correct time reported: >> >> But running Python for Windows (it doesn't matter which, specifically >> for the test I used the one from MS Store [1]), I have incorrect >> local time > > ... > > Though as to why -- likely the windows version is getting time zone > clues + correction from BOTH cygwin and Windows, like it's told its > in a TZ that is at 1 time, while Windows feeds it other data that > says it is 2 hours off from the default. As described in Python's issue [1], the problem comes from passing a TZ environment variable value that is invalid for Windows C runtime [2]. So in the end, it *might* be something for Cygwin to handle. *If* Cygwin can detect that it starts a native Windows binary (I hope it can), then it could try to convert the TZ from Unix kind to Windows kind. That way, it could become valid. Or at least it could be unset (but that is questionable). Of course, I could overlook some possible drawbacks from this imagined fix, which could make it undesirable. Anyway, I have implemented a workaround in our project unsetting TZ before calling Python, and it's resolved for us. Thanks! [1] https://bugs.python.org/issue44352 [2] https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tzset?view=msvc-160 -- Best regards, Mike Kaganski