This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PING^3] RFC [PATCH] BZ#1077902: New API gettimezone
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: P J P <pj dot pandit at yahoo dot co dot in>
- Cc: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Tue, 27 May 2014 20:08:27 +0200
- Subject: Re: [PING^3] RFC [PATCH] BZ#1077902: New API gettimezone
- Authentication-results: sourceware.org; auth=none
- References: <5361D8D1 dot 60400 at redhat dot com> <5361E805 dot 9080606 at cs dot ucla dot edu> <5361F22E dot 3070206 at redhat dot com> <53628A02 dot 9080702 at cs dot ucla dot edu> <53629388 dot 1060301 at redhat dot com> <53630B0C dot 1050305 at cs dot ucla dot edu> <53633A37 dot 7060405 at redhat dot com> <5363E223 dot 7060303 at cs dot ucla dot edu> <1399061963 dot 56150 dot YahooMailNeo at web192404 dot mail dot sg3 dot yahoo dot com> <1401211363 dot 50264 dot YahooMailNeo at web192402 dot mail dot sg3 dot yahoo dot com>
On Wed, May 28, 2014 at 01:22:43AM +0800, P J P wrote:
> Ping! (sorry I was away for long)
> ---
> Regards
> -Prasad
> http://feedmug.com
As was previously said I prefer to stick with existing API instead of
new one, so localtime_rz is preferable. It does not to be effective
initially, something like this could work:
pthread_mutex_t l;
localtime_rz(new, resultp)
{
pthread_mutex_lock (l);
char *old = strdup (getenv ("TZ"));
setenv ("TZ", (char *) new);
tzset ();
result = localtime (resultp);
setenv ("TZ", old);
tzset ();
free (old);
pthread_mutex_unlock (l);
return result;
}