Looking for non-TZ-dependent localtime()

( Marc A. Lehmann ) pcg at goof.com
Wed Aug 4 01:24:46 UTC 2004


On Tue, Aug 03, 2004 at 03:04:39PM -0400, Michael Lindner <mlindner at idttechnology.com> wrote:
> I have a multithreaded server that has a thread per client, and needs to 
> talk to clients in their local timezone. All the "normal" UNIX time 
> functions rely on "TZ" for timezone information, so even though they're 
> nominally "thread-safe" they don't support my application, since TZ is 
> global across threads.
> 
> Is there a localtime()-like implementation out there that can do what I 

I am sure others will additionally have useful advise, but why don't you just
put a lock around your calls to localtime?

localtime is rarely a bottleneck (it might be for your application), so
this shouldn't be a problem.

-- 
                The choice of a                              |
      -----==-     _GNU_                                     |
      ----==-- _       generation     Marc Lehmann         +--
      ---==---(_)__  __ ____  __      pcg at goof.com         |e|
      --==---/ / _ \/ // /\ \/ /      http://schmorp.de/   --+
      -=====/_/_//_/\_,_/ /_/\_\      XX11-RIPE            |
                                                           |



More information about the tz mailing list