From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) by sourceware.org (Postfix) with ESMTPS id 96A963851C3E for ; Wed, 9 Jun 2021 03:43:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 96A963851C3E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSw.ab.ca Authentication-Results: sourceware.org; spf=none smtp.mailfrom=systematicsw.ab.ca Received: from [192.168.1.104] ([68.147.0.90]) by shaw.ca with ESMTP id qp7clFr6Jycp5qp7dl98AB; Tue, 08 Jun 2021 21:43:17 -0600 X-Authority-Analysis: v=2.4 cv=H864f8Ui c=1 sm=1 tr=0 ts=60c038d5 a=T+ovY1NZ+FAi/xYICV7Bgg==:117 a=T+ovY1NZ+FAi/xYICV7Bgg==:17 a=IkcTkHD0fZMA:10 a=w_pzkKWiAAAA:8 a=yMhMjlubAAAA:8 a=mBgxTecq67T4SJcK1WkA:9 a=QEXdDO2ut3YA:10 a=qH7zXGipjgEA:10 a=sRI3_1zDfAgwuvI8zelB:22 Reply-To: cygwin@cygwin.com Subject: Re: Python for Windows reports wrong local time when run under Cygwin on Europe/Moscow TZ To: cygwin@cygwin.com References: From: Brian Inglis Organization: Systematic Software Message-ID: Date: Tue, 8 Jun 2021 21:43:15 -0600 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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4xfLXabjQ4v+nO1Yigy29gX1nerzNobSwvkc5PV090xc7Yk2tE5P/T2DcZumowdjslNemx3g/tD3LAn6SrkdRlUnyhGE2WgSQ/m/PfXAaAojrjft6X7qVH eeaAJtZ1xaFv3iAT1hGA74hInp+ubMCyqbiE2pjiOK3y5hT7SPHyhb7XAWtm3tWNAYbzet0GTJdm3NuraXvPQ4yik+seopbYaRc= X-Spam-Status: No, score=-3487.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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@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: Wed, 09 Jun 2021 03:43:20 -0000 On 2021-06-08 11:37, Keith Thompson via Cygwin wrote: > There is a known problem with the $TZ environment variable. > > Here's a discussion from 2017: > https://cygwin.com/pipermail/cygwin/2017-May/232675.html > > The problem is that both Cygwin and Windows use the $TZ environment > variable, but they interpret it differently. > > The Windows handling of $TZ (or %TZ%) is documented here: > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tzset?view=msvc-160 > > For example, Pacific Time is represented as TZ=PST8PDT. > > In Cygwin, my $TZ is set by default to "America/Los_Angeles". > Any Windows applications that I invoke from Cygwin, if they attempt > to determine the time zone, will behave inconsistently because they > don't see "America/Los_Angeles" as a valid time zone string. > > I've worked around this by unsetting TZ in my .bash_profile . > Cygwin applications are still able to determine the correct time zone. > > I suggest that Cygwin should *not* set the TZ environment variable. In that case, those affected should comment out the last line of each: $ tail /etc/profile.d/tzset.*sh ==> /etc/profile.d/tzset.csh <== # Modifying /etc/profile.d/tzset.csh directly will prevent # setup from updating it. # System-wide tzset.csh file #Uses the geographical location setting of the user to find the right #mapping, rather than the locale setting. Only on Windows 2000 which #doesn't know about the user's geographical location, or if fetching #the geographical location fails, it falls back to the user's locale. if ( $?TZ == 0 ) setenv TZ `/usr/bin/tzset` ==> /etc/profile.d/tzset.sh <== # Modifying /etc/profile.d/tzset.sh directly will prevent # setup from updating it. # System-wide tzset.sh file #Uses the geographical location setting of the user to find the right #mapping, rather than the locale setting. Only on Windows 2000 which #doesn't know about the user's geographical location, or if fetching #the geographical location fails, it falls back to the user's locale. test -z "$TZ" && export TZ=$(/usr/bin/tzset) -- 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.]