Re: LC_ALL and TZ



Roozbeh Pournader wrote:
> No, the "timezone" selector for locales (the table in section 3 of LDML)
> is about which timezone is in use for the locale. It's the same as the
> TZ variable then.

Ouch. We have a conflict with POSIX ([1], [2]) here. If a user sets
TZ=GMT+3 and LC_ALL=de_DE timezone=GMT+1, and /etc/localtime is GMT+0,
then what shall the library functions do?

In Danilo's perspective, when a GUI has a dialog for changing the timezone,
it cannot work through an environment variable like TZ; it can only work
through the /etc/localtime link - which requires superuser priveleges -
or through the locale id which is broadcasted to all running GUI applications.

So, a compromise is probably to say:
  - If TZ is set, the library obeys it.
  - If not, it looks at the info in the locale identifier.
  - If absent, it uses the libc's timezone (which on Linux is based on
    /etc/localetime).

But this clearly will only work satisfactorily if all applications use
our library and none uses libc's strftime(). Because otherwise, in case 2
(TZ not set but locale identifier contains timezone specification),
applications that use libc API will show a different time than applications
that use our library.

What can we do? Just ignore the @timezone=... setting, for consistency with
libc?

A possible solution is that when a locale id with timezone=... is broadcasted
to all running GUI applications, the receiving applications call setenv("TZ")
to synchonize libc's notion of timezone with that of our library.

Bruno


[1] http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html
[2] http://www.opengroup.org/onlinepubs/009695399/functions/timezone.html




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]