Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 May 2001 20:16:47 +0400
From:      "Andrey Simonenko" <simon@comsys.ntu-kpi.kiev.ua>
To:        "Gil Rudge" <gil-rudge@usa.net>
Cc:        <freebsd-hackers@freebsd.org>
Subject:   Re: Problem with the time zone in version 4.3
Message-ID:  <024601c0e85a$c2f1c8a0$6d36120a@comsys.ntukpi.kiev.ua>
References:  <20010529140859.16477.qmail@nwcst282.netaddress.usa.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?024601c0e85a$c2f1c8a0$6d36120a>