From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp61.i.mail.ru (smtp61.i.mail.ru [217.69.128.41]) by sourceware.org (Postfix) with ESMTPS id 3FA5B3853818 for ; Mon, 7 Jun 2021 06:59:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3FA5B3853818 Received: by smtp61.i.mail.ru with esmtpa (envelope-from ) id 1lq9Eo-0002uY-BA for cygwin@cygwin.com; Mon, 07 Jun 2021 09:59:54 +0300 To: cygwin@cygwin.com From: Mike Kaganski Subject: Python for Windows reports wrong local time when run under Cygwin on Europe/Moscow TZ Message-ID: <5542c19d-8b1a-1f28-2003-fe9493ee9b56@mail.ru> Date: Mon, 7 Jun 2021 09:59:52 +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 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D5B0DA836B685C54F4BC37E91F2690B85F43D7652182C513182A05F5380850403C9D752CE857356E5C6D3753BF652037DF7B0BA5E149596A475DAECEA3486C09 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A8325FA649D0A450EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BFD6B3F1638522B88638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8E7EDFBCAC64EE8FCF0C1F4F45282EBDB6F9789CCF6C18C3F8528715B7D10C86878DA827A17800CE7328B01A8D746D8839FA2833FD35BB23D9E625A9149C048EE9ECD01F8117BC8BEA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD182CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EEC8105B04EFE076282D242C3BD2E3F4C64AD6D5ED66289B52698AB9A7B718F8C46E0066C2D8992A16725E5C173C3A84C3C286BE52C5814EF6BA3038C0950A5D36B5C8C57E37DE458B0BC6067A898B09E46D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE708FD7798F0903B84731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C4C015FF9C65CDDEB8CCB322614A162F642960F9FBE35F2CE9C2B6934AE262D3EE7EAB7254005DCED1C8AEA1E975C27AC1E0A4E2319210D9B64D260DF9561598FCFFBF5018520E39845C972DC301F7D148E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D340DAE5B306C240CF5574E4AB198AA6CD15A0292AC9CC0C4ECEC2F8C1C8CEC01039EE290B474089BF01D7E09C32AA3244C32A3CEAB2754748724AB03931E724799A90944CA99CF22E33EB3F6AD6EA9203E X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXieGc4NN1MWQVg7xlOIE1on X-Mailru-Sender: 00097D31F91C944B962E58D3528817579432F94BBC75045A02CF62A815532BA2C16467F3597DCACC8D3DB682BF6F1158E66B5C1DBFD5D09D046C2275A8D60F931CD745D6427E807167EA787935ED9F1B X-Mras: Ok X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_20, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, 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: Mon, 07 Jun 2021 07:00:06 -0000 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: > mikek@DESKTOP-8SHAE9Q ~ > $ python > Python 3.8.9 (default, Apr 21 2021, 23:14:29) > [GCC 10.2.0] on cygwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import datetime > >>> datetime.datetime.now() > datetime.datetime(2021, 6, 7, 9, 40, 15, 318391) 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: > mikek@DESKTOP-8SHAE9Q ~ > $ "C:/Program > Files/WindowsApps/PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0/python3.8.exe" > Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC > v.1928 64 bit (AMD64)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import datetime > >>> datetime.datetime.now() > datetime.datetime(2021, 6, 7, 7, 40, 55, 503775) Note how the latter output reports 2021-06-07 07:40, while the former reports 2021-06-07 09:40. The difference is 2 hours. Starting the same Python for Windows from cmd.exe has it correct: > C:\Users\mikek>python > Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC > v.1928 64 bit (AMD64)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import datetime > >>> datetime.datetime.now() > datetime.datetime(2021, 6, 7, 9, 41, 21, 925240) Cygwin reports correct timezone: > $ echo $TZ > Europe/Moscow Starting Python for Windows using a different timezone (specifically, '$ TZ=UTC "C:/Program Files/WindowsApps/PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0/python3.8.exe"') gives correct time for *that* time zone. This is a problem, because in our project (LibreOffice), we use Cygwin as environment for unit testing, where LibreOffice's own Python (also built natively for Windows) is used, and at some times (from 00:00 till 02:00) it reports wrong dates, which makes tests fail locally on affected systems(see [2]). Thank you! [1] https://www.microsoft.com/en-us/p/python-38/9mssztt1n39l [2] https://gerrit.libreoffice.org/c/core/+/92217/2#message-f55091795e7cde9d75adc00ddb69451121b644f6 -- Best regards, Mike Kaganski