Date: 29 May 2001 16:08:59 IST From: Gil Rudge <gil-rudge@usa.net> To: freebsd-hackers@freebsd.org Subject: Problem with the time zone in version 4.3 Message-ID: <20010529140859.16477.qmail@nwcst282.netaddress.usa.net>
next in thread | raw e-mail | index | archive | help
I encountered a small problem while changing the time zone. I have a process (process A) that starts when the machine is booted and w= aits for requests. In another process I changed the time zone. When running date (from any o= ther 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 =3D localtime(&tval); Note that I made a small exe that ran the same lines of code as above, wh= en 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 ge= t 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 ? Thanks, Gil = ____________________________________________________________________ Get free email and a permanent address at http://www.netaddress.com/?N=3D= 1 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010529140859.16477.qmail>