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