delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/06/09/18:31:51

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D462B39BDC20
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1623277908;
bh=4M31tWLLCTE58DTgFrZ8dmtFVhADKCTK9vQfIESmcy0=;
h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=Wh8jvtLIqA0+h+vMbhODVEAkr+f1OORu3NRGFWuqnYoqkhWqmYMHJdzupSBzYbRwS
7rE24BgZTbFx20fTaUlH4IINBn8+tgTugC1qoMNDUFjjJfr6RotX00srYz8mc76Q3E
3FBoE+9Xev0lojUXr2pBCHeEu/5HzOC50nILFiqk=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 193D13857407
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=ZnmlheeOLmXKGeH11x6rkkbMyqYPwziJWx0D8Nz3wUE=;
b=Dx9HSrX1Qcv//SAF8753a06HRsRmobY3ORiayQSvYtEsc8pfrICkBXkBvAH/MqXnDH
RTcwY38HDWPJtm06fgoD8u6L8ZUeuzr29FtQQkCilvzevgte4RS40CUazuDU4sO8WPqY
6+wRpxhHtMvItZfmPYi0eqR22ZSEa30383MzpiwxajCdOFtPnIruUrBp2Htqwvmj1PnT
0KPzlfn5F4MS9HseeNLxOAd5P0dyUebfYHGcp57NxbFdumkf9rsVuotMFYqrDglJZ3OQ
ZpmygwVYE/064mXJusHUNKfiGCX7Mq2m5KtyTfVfqQfSXWR/0GBLhvCODc7uaqrMCWay
slag==
X-Gm-Message-State: AOAM530s3+SbZP7nNCCGlnZuO1YUP/2/zM5diSsxP6j6x85FdrzPUXN/
VhSxM6l4vkiQXNBVJJfGu2tYYJ04N2xkYjdjwAopT9/GuXE/pg==
X-Google-Smtp-Source: ABdhPJzpIYqc0FU9uxGkg5cu7RbOFQ+F+WeXHUwawmC4cVJm0AAiUPyAQvcksL8Q2afHtLD/vHdJW+zq1IKfUcdpMZQ=
X-Received: by 2002:a17:906:2988:: with SMTP id
x8mr1812337eje.122.1623277876993;
Wed, 09 Jun 2021 15:31:16 -0700 (PDT)
MIME-Version: 1.0
References: <CAAHpriO6A+6bLXt0Qe-xpdXT1CiLjk7=7G31cHBtnVJ0kXb2Eg AT mail DOT gmail DOT com>
In-Reply-To: <CAAHpriO6A+6bLXt0Qe-xpdXT1CiLjk7=7G31cHBtnVJ0kXb2Eg@mail.gmail.com>
Date: Wed, 9 Jun 2021 15:31:06 -0700
Message-ID: <CAAHpriOJ5EZ0YzXjNOV-fydCb6bWHmPKiFZUC7KtFAi8DnkkDQ@mail.gmail.com>
Subject: Re: Python for Windows reports wrong local time when run under Cygwin
on Europe/Moscow TZ
To: cygwin AT cygwin DOT com
X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,
SPF_HELO_NONE, 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 AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Keith Thompson via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Keith Thompson <Keith DOT S DOT Thompson AT gmail DOT com>
Cc: Keith Thompson <Keith DOT S DOT Thompson AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

[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.

-- 
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019