From owner-freebsd-questions Thu Mar 18 7:54:16 1999 Delivered-To: freebsd-questions@freebsd.org Received: from kronos.alcnet.com (kronos.alcnet.com [207.244.223.187]) by hub.freebsd.org (Postfix) with ESMTP id CC9EF14C57 for ; Thu, 18 Mar 1999 07:54:10 -0800 (PST) (envelope-from kbyanc@alcnet.com) Received: from localhost (kbyanc@localhost) by kronos.alcnet.com (8.9.3/8.9.3/antispam) with ESMTP id KAA54080; Thu, 18 Mar 1999 10:57:48 -0500 (EST) X-Envelope-To: freebsd-questions@FreeBSD.ORG X-Server: ALC Communications - http://www.alcnet.com/ Date: Thu, 18 Mar 1999 10:57:48 -0500 (EST) From: Kelly Yancey To: Jonathan Chen Cc: freebsd-questions@FreeBSD.ORG Subject: Re: proper way to set TZ? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 18 Mar 1999, Jonathan Chen wrote: > On Wed, 17 Mar 1999, Kelly Yancey wrote: > > > > > I have a couple of scripts which rely on TZ being set to the server's > > time zone. What is the proper was to do this so I don't have to put a > > TZ=EST; export TZ before invoking any of the scripts. > > Is there a startup script that this should be in? If so, which one? > > TZ is a SysV mechanism. What are you trying to do, exactly? If you > really want to get it, I suppose one way of doing it is to get the > output of: > > date '+%Z' > Hmm. The problem is that the scripts are currently written in perl (which doesn't actually have a built-in interface to ctime, although I suppose if I get desparate I could make a ph file from the c header). I have already written some code which splits all the information out of gmtime or localtime in perl but it can't get the timezone. It would seem that my solutions are limited to: Just invoking the date command and stripping the trailing newline (downside: fork overhead just to get the time) Living without the timezone (downside: I really need the timezone recorded in logs) Where exactly does the ctime() get it's timezone information? Where is it recorded...I can set it with tzset but I can't get the information back out. I really appreciate the help! Kelly > -- > Jonathan Chen | "Vini, vidi, velcro... > | I came, I saw, I stuck around" > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message