From owner-freebsd-hackers Tue May 29 10:29:34 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from relay1.ntu-kpi.kiev.ua (www.ntu-kpi.kiev.ua [212.111.192.161]) by hub.freebsd.org (Postfix) with ESMTP id 32A4237B423 for ; Tue, 29 May 2001 10:29:26 -0700 (PDT) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from comsys.ntu-kpi.kiev.ua (eth0.comsys.ntu-kpi.kiev.ua [10.0.1.184]) by relay1.ntu-kpi.kiev.ua (Postfix) with ESMTP id A7BEA2F6B6; Tue, 29 May 2001 20:29:09 +0300 (EEST) Received: from pm5149 (pm514-9.comsys.ntu-kpi.kiev.ua [10.18.54.109]) by comsys.ntu-kpi.kiev.ua (8.11.3/8.11.3) with SMTP id f4THJ7P07887; Tue, 29 May 2001 20:19:08 +0300 (EEST) Message-ID: <024601c0e85a$c2f1c8a0$6d36120a@comsys.ntukpi.kiev.ua> From: "Andrey Simonenko" To: "Gil Rudge" Cc: References: <20010529140859.16477.qmail@nwcst282.netaddress.usa.net> Subject: Re: Problem with the time zone in version 4.3 Date: Tue, 29 May 2001 20:16:47 +0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I think that http://www.freebsd.org/cgi/query-pr.cgi?pr=23323 will be interesting for you. ----- Original Message ----- From: Gil Rudge Newsgroups: lucky.freebsd.hackers Sent: Tuesday, May 29, 2001 6:09 PM Subject: Problem with the time zone in version 4.3 > I encountered a small problem while changing the time zone. > > I have a process (process A) that starts when the machine is booted and waits > for requests. > > In another process I changed the time zone. When running date (from any other > terminal) I get the time with the newly changed time zone, but in process A > when I read the tm struct I still read the old time zone. > > In process A, I read the tm struct by using: > > time_t tval; > time(&tval); > struct tm *ltm = localtime(&tval); > > Note that I made a small exe that ran the same lines of code as above, when I > ran it I also read the correct time, from any terminal. > > I found out that if I preceded the calls above with this code bellow,I get the > correct time zone. Note that the same code without the set or unset calls does > not work either. > > setenv("TZ", ":/etc/localtime", 1); > tzset(); > unsetenv("TZ"); > > > I would like to know the reason for this phenomena, and is there a better way > to solve it ? > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message