Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Aug 2009 10:53:59 -0400
From:      Greg Larkin <glarkin@FreeBSD.org>
To:        Peter Steele <psteele@webmail.maxiscale.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How is time zone change signalled?
Message-ID:  <4A7C4007.9000506@FreeBSD.org>
In-Reply-To: <B8A480488C0C6849826655761349EA431F713D@owa.webmail.maxiscale.com>
References:  <B8A480488C0C6849826655761349EA431F713D@owa.webmail.maxiscale.com>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Peter Steele wrote:
[...]
>  
> 
> The problem is with our C applications. They continue to operate with
> the old time zone, so things like timestamps in log files are not in
> sync with the timestamps in the Java app log files. If we stop and
> restart the C apps they pick up the time zone change. However, we don't
> want to take this extreme approach. We want the Java app to signal to
> the C applications that the time zone has changed. However, I've
> experimented with the various time zone related calls and I cannot
> figure out what call is needed to make the C applications pick up the
> time zone change. I've tried setting the environment variable TZ to the
> new time zone and this doesn't seem to work, and I've tried calling
> tzset() and tzsetwall(). In each case after I make these calls the
> function "localtime()" does not return the same time base as the Java
> application.
> 

Hi Peter,

Did you try unsetting TZ and then calling tzset()?  The man page implies
that doing so will force a reread of /etc/localtime
(http://www.freebsd.org/cgi/man.cgi?query=tzset&sourceid=opensearch):

"The tzset() function initializes time conversion information used by
the library routine localtime(3).  The environment variable TZ specifies
how this is done.

If TZ does not appear in the environment, the best available
approximation to local wall clock time, as specified by the
tzfile(5)-format file /etc/localtime is used."

I haven't tested it, though, and I'm no timezone expert, so I may be
completely off-base!

Cheers,
Greg
- --
Greg Larkin

http://www.FreeBSD.org/       - The Power To Serve
http://www.sourcehosting.net/ - Ready. Set. Code.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFKfEAG0sRouByUApARAkFQAKCq3PdqsoJ4aMMnNcoUgwHwOcOlLACfczQ/
vzfWIYV/n7TEgq6jIgCnVnE=
=6Bwv
-----END PGP SIGNATURE-----




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A7C4007.9000506>