automatic TZ env-variable in localtime "problem" with W2000-germa n

Christopher Faylor
Sun Mar 3 21:18:00 GMT 2002

This is not a patch.

You'd be well-advised to peruse past messages in this mailing list and
also look at the Contributing link of the cygwin web page so that you
can see how this is supposed to be done.

Who knows?  Your rebuild problems might actually be mentioned in the
archives, too.


On Wed, Feb 27, 2002 at 06:35:05PM +0100, Markus K. E. Kommant wrote:
>I have the following problem, or misunderstandig(!) of TZ variable in
>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 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?
> (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
>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)

More information about the Cygwin-patches mailing list