This is the mail archive of the libc-alpha@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: [PING^3] RFC [PATCH] BZ#1077902: New API gettimezone


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;
}


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