delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/08/04/10:42:30

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <42F22878.7060406@hones.org.uk>
Date: Thu, 04 Aug 2005 15:38:48 +0100
From: Cliff Hones <cliff AT hones DOT org DOT uk>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Timezone names
X-Spam-Score: -2.4 (--)
X-IsSubscribed: yes

I was curious as to why, under Cygwin, the default UK timezone
names (eg as displayed by "date") are different from the standard
names.  [Standard UK names are GMT and BST, while Cygwin displays
GMTST and GMTDT.]  So I did some source digging.  Forgive me if the
following info is already readily available - but I couldn't find
it.  Note that the Cygwin FAQ admits to being out of date:
   http://cygwin.com/faq/faq_3.html#SEC85

Cygwin does not use the Newlib version of tzset - there is a
Cygwin-specific implementation in localtime.cc.  Unlike the
Newlib tzset, if environment TZ is not set, the Cygwin version
uses Windows API GetTimeZoneInformation.  The timezone names
as seen by Cygwin are set using just the the capital letters in
the Windows timezone names  (which, for the UK, are "GMT Standard Time"
and "GMT Daylight Time").

Of course, this affets other timezones too; most US zones translate
to their standard names, but Central America will generate CAST/CADT
rather than CST/CDT.

To get the more standard names, one can, of course, set the
TZ environment variable explicitly (eg to "GMT0BST").  There is
logic to complement the TZ setting info with default info from
built in posixrules, but it's not clear to me if this will set the
daylight saving on/off points correctly.  An alternative solution,
which will use the Windows daylight saving info as before is to
update the Windows timezone database directly.  I believe there is
a "tzedit" tool to do this in Windows resource kits, but it is easy
to do using the registry [ok, I know this is frowned on].  The timezone
names (in NT/2K/XP) are in
   HKLM\Software\Microsoft\Windows NT\Current Version\TimeZones\<yourzone>
(eg ..\GMT Standard Time for UK).
The keys "Std" and "Dlt" specify the zone names - I changed mine to
be "Greenwich Mean Time" and "British Summer Time".  After the change,
to make it effective, use the Windows "Adjust Date/Time" dialog to reselect
your timezone.

OBLIGATORY WARNING - Do not modify registry settings unless you are confident
you know what you are doing, and know how to restore previous settings if
your system subsequently malfunctions.

A possibly better solution, one day, would be for the "localtime" implementation
to be implemented for Cygwin, with zone files in /usr/share/zoneinfo.

-- Cliff


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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