From owner-freebsd-stable Wed Mar 3 8: 3:30 1999 Delivered-To: freebsd-stable@freebsd.org Received: from mailhost.stack.nl (terra.stack.nl [131.155.140.128]) by hub.freebsd.org (Postfix) with ESMTP id 7406914ED4 for ; Wed, 3 Mar 1999 08:03:21 -0800 (PST) (envelope-from marcolz@stack.nl) Received: from toad.stack.nl (toad.stack.nl [131.155.140.135]) by mailhost.stack.nl (Postfix) with ESMTP id 5B05F2FF1 for ; Wed, 3 Mar 1999 17:02:55 +0100 (MET) Received: by toad.stack.nl (Postfix, from userid 333) id 302699672; Wed, 3 Mar 1999 17:02:56 +0100 (CET) Date: Wed, 3 Mar 1999 17:02:56 +0100 From: Marc Olzheim To: stable@freebsd.org Subject: tzset in libc Message-ID: <19990303170256.A15288@stack.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i X-Operating-System: FreeBSD toad.stack.nl 2.2.8-STABLE FreeBSD 2.2.8-STABLE X-URL: http://www.stack.nl/~marcolz/ Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, I was wondering why it was that each time you call localtime() or strftime(), tzset() is called also. Isn't it so that it only has to be called once per process and then be regearded as already set ? Why I am asking this is because when I profiled a program of mine that called localtime() about 2 million times it also called getenv() 2 million times also. And since getenv() is a relatively slow operation, it yielded more than 50% performance when I patched libc not to call tzset() each time. When the timezone changes, you'd have to call tzset() manually, but in my case, it's worth it. Just curious.... Marc To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message