TZ environment variable

Robbin Kawabata Robbin.Kawabata at eng.sun.com
Thu May 19 20:06:41 UTC 2005


There was some discussion about localized tznames.  SunOS currently doesn't
support localized tzname's.  If we were to implement it, we would probably take
the approach of i18n messages.  We could create message catalogs for Olson
timezone tznames, which contain translated tznames for the locales.   
A message-id could be created, perhaps by concatenating the timezone name 
with the tzname (for example, "America/Los_Angeles_PST").  The message-id 
could be passed to dcgettext(), which would return the localized tzname 
according to the locale specified by LC_TIME.  We might use a new specifier 
in strftime() (which would call dcgettext()) to return the localized tzname 
or the original tzname if no localized tzname exists.

We would keep the values of TZ and tzname[] as elements from the portable
character set.  The TZ environment variable is inherited by applications.
By default applications start in the C locale.  If a time function is called
before setlocale() is done (or if the application does not call setlocale()),
the time function could fail if TZ is composed of invalid characters for
the C locale.  Also, if TZ or tzname[] is composed of multibyte characters,
and the application changes locales, it could invalidate those characters.

Robbin




More information about the tz mailing list