Re: Problem with the time zone in version 4.3

[ Available lists | Index of freebsd-hackers | Month of May 2001 | Week of 29 May 2001 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
Date
29 May 2001 10:29:34
Subject
Re: Problem with the time zone in version 4.3
Message-ID
024601c0e85a$c2f1c8a0$6d36120a@comsys.ntukpi.kiev.ua

References to

[ Hide this part ]
I think that http://www.freebsd.org/cgi/query-pr.cgi?pr=23323
will be interesting for you.

----- Original Message -----
From: Gil Rudge <gil-rudge@usa.net>
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



Elapsed time: 0.106 seconds