This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: RFC [PATCH] BZ#1077902: New API gettimezone
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Carlos O'Donell <carlos at redhat dot com>, Rich Felker <dalias at aerifal dot cx>, P J P <pj dot pandit at yahoo dot co dot in>
- Cc: "libc-help at sourceware dot org" <libc-help at sourceware dot org>
- Date: Thu, 03 Apr 2014 23:50:20 -0700
- Subject: Re: RFC [PATCH] BZ#1077902: New API gettimezone
- Authentication-results: sourceware.org; auth=none
- References: <1396499286 dot 85118 dot YahooMailNeo at web192405 dot mail dot sg3 dot yahoo dot com> <533CF5E8 dot 9010009 at cs dot ucla dot edu> <1396518081 dot 53447 dot YahooMailNeo at web192403 dot mail dot sg3 dot yahoo dot com> <533D73DF dot 1040009 at cs dot ucla dot edu> <1396546236 dot 69027 dot YahooMailNeo at web192401 dot mail dot sg3 dot yahoo dot com> <20140403194040 dot GG26358 at brightrain dot aerifal dot cx> <533DD86D dot 10908 at redhat dot com> <533DE5CA dot 5040905 at cs dot ucla dot edu> <533E16A5 dot 5030701 at redhat dot com> <533E1AB7 dot 5090804 at cs dot ucla dot edu> <533E471F dot 9040101 at redhat dot com>
Carlos O'Donell wrote:
So the answer is "Use Boost.Date_Time?"
That's no answer, as Boost.Date_Time doesn't provide the requested
functionality.
it is a flaw in the API not to provide
a way for the application to both query and set the timezone.
But there is a way: get and set the TZ environment variable. True, this
doesn't let you get at the contents of /etc/localtime when TZ is unset;
but the simple solution is to not rely on /etc/localtime, and to always
set TZ.
While I agree that using UTC simplifies things, and that it may
be the case that wide-spread use of UTC will fix these problems,
Not "will fix". *Has* fixed. It's what people have been doing for
*decades*, and it *works*.
I don't see using UTC as an acceptable solution for all users
People who want to run non-UTC servers (which is a bad idea) can set TZ.
Problem solved.
Is something like tzget() really a bad idea?
Something like that *might* be implemented. But doing it right would be
a lot of work for a small benefit. There are far more-pressing problems
in the time zone API, such as, why isn't there a thread-safe way to set
and get the time zone? If you want to work on improving this area of
glibc, please work on *that*. That's a *real* need, and there's
existing practice (NetBSD).