bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tzset: add native Windows workaround


From: Ken Brown
Subject: Re: tzset: add native Windows workaround
Date: Wed, 3 May 2017 12:08:58 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 5/3/2017 11:24 AM, Paul Eggert wrote:
On 05/03/2017 04:31 AM, Ken Brown wrote:
Perhaps the Cygwin folks could be talked into changing an unset TZ to
mean "ask the Windows Control Panel".

This seems to already be happening.  Here's what I see on my Cygwin
system:

$ echo $TZ
America/New_York

$ date +'%Y-%m-%d %H:%M:%S %z (%Z)'
2017-05-03 07:29:03 -0400 (EDT)

$ TZ= date +'%Y-%m-%d %H:%M:%S %z (%Z)'
2017-05-03 11:29:14 +0000 (GMT)

$ unset TZ

$ date +'%Y-%m-%d %H:%M:%S %z (%Z)'
2017-05-03 07:29:30 -0400 (EDT)

Hmm, but is the last output line because the Windows Control Panel
specifies New York time, or because there is a 'localtime' file
maintained by Cygwin that specifies New York time? I'm guessing the
latter, since that's what glibc does. The former is what Bruno is asking
for.

There's no localtime file. If TZ is not set, then Cygwin calls tzsetwall (defined in winsup/cygwin/localtime.cc), which gets the time zone from the Windows function GetTimeZoneInformation. I verified this by running the date command above under gdb.

Ken



reply via email to

[Prev in Thread] Current Thread [Next in Thread]