automatic TZ env-variable in localtime "problem" with W2000-germa n
Markus K. E. Kommant
Markus.Kommant@de.adp.com
Mon Feb 11 08:39:00 GMT 2002
Hello,
I have the following problem, or misunderstandig(!) of TZ variable in
cygwin1.dll.
Problem (and my current solution)
When I do not set TZ to a valid value, all times will be showed as GMT (or
UTC) time.
The automatic generated TZ variable in localtime.cc will generate a name
from GetTimeZoneInformation.
When I test this algorithm in a program, the name will be invalid (longer
than 3 characters).
At the moment I have problems to rebuild the cygwin1.dll (make will make a
lot of things but I do find a simple make cygwin1.dll...)
Is it a good, bad, very bad idea to test the length of the name against 3 to
generate a TZ variable compatible with tzparse?
localtime.cc (not tested, because I was not able to build cygwin1.dll)
GetTimeZoneInformation(&tz);
(...)
for (src = tz.StandardName; *src; src++)
if (is_upper(*src)) *dst++ = *src;
/* not 3 characters for timezone _tzname[0] ?
happens for example in Win2000/NT german version
a) tz.StandardName is a WideChar String
b) is very long "Westeropaische Normalzeit"
generate a TZ variable relative to GMT-x
(if strlen of _tzname is not equal 3 , tzparse will
not accept the TZ variable!)
mkt */
if (strlen(cp) != 3) /* mkt */
{ /* mkt */
strcpy(cp, "GMT"); /* mkt */
dst = cp + 3; /* mkt */
} /* mkt */
(...) same for the daylight saving time with DST.
When I call this function as a separate routine win32_tzset (roughly written
in win32_tzset.c for my VC program and Cygwin-GNU ports) the TZ variable
will be understood and the correct times will be chown.
pdksh port with a call to win32_tzset to set TZ automatically from Windows
Control Panel:
pdksh $ echo $TZ
GMT-1DST-2,M3.5.0/2,M10.5.0/3
pdksh $ date
Mon Feb 11 17:35:54 2002
(yes this the current time)
bash-2.05a$ date
Mon Feb 11 16:36:25 2002
(no, this the UTC time)
<<win32_tzset.c>> <<localtime.cc>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win32_tzset.c
Type: application/octet-stream
Size: 3621 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20020211/d3025129/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: localtime.cc
Type: application/octet-stream
Size: 54354 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20020211/d3025129/attachment-0001.obj>
-------------- next part --------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list