This is the mail archive of the libc-help@sourceware.org mailing list for the glibc 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]

Re: RFC [PATCH] BZ#1077902: New API gettimezone


On 04/03/2014 06:50 PM, Paul Eggert wrote:
> Carlos O'Donell wrote:
>> What do we do then?
> 
> We say, "sorry, the problem is out of scope".  If you're trying to
> copy the contents of /etc/localtime to some random configuration, it
> might not even work there.  These file formats change occasionally,
> for example.
> 
> glibc doesn't need an API change.  People who have this problem can
> save the contents of the TZ environment variable (or record that it's
> unset), and standardize on UTC in /etc/localtime.  That's good
> enough.
> 
> I'm redirecting this to libc-help because this thread is really more
> about helping someone use the system than about changing the libc
> API.

Your solution, particularly standardizing on UTC, imposes on the
developer to rewrite whatever software they are using for what
is an arbitrary decision of "Use UTC."

Can't we do better?

e.g.

char *ltz;
int ret;
ltz = gettimezone (NULL);
if (setenv ("TZ", ltz, 1) != 0)
  /* Error.  */
/* Run chroot'd process with TZ set in the environment.  */
...
free (ltz);

Why is there no portable or reliable way to start a child process
with the same timezone as your own?

Even if we added a `settimezone (char *tz);` and passed data
to the child, that would be fine, and avoid the POSIX TZ style
issues.

Note that Windows 7 and 8 have functions like this that do
similar things, but that isn't a reason for adopting anything
like this, but an indication that Microsoft saw a need for
this (See [SG]etDynamicTimeZoneInformation).

Cheers,
Carlos.


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