This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Timezone names


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]