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

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

Reply via email to