How to signal a time zone change?

Julian Elischer julian at elischer.org
Fri Aug 7 21:06:03 UTC 2009


Peter Steele wrote:
> We have a suite of applications with a Java GUI controlling everything.
> One of the actions the user can perform is to set the time zone. We do
> this through our Java application and update the /etc/localtime as
> required. We also make an API call to tell the JVM that the time zone as
> changed, and from the perspective of the Java app, the time zone is
> changed correctly (the timestamps for example in our log files reflect
> the change). Likewise, after the user performs this action, running
> "date" on one of our systems shows that the time zone has been changed
> as requested. 
> 
>  
> 
> 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

You need to signal your app in some way.. Assuming you have source for 
the app then you can monitor /etc/localtime (or /etc) for change with
kevent.

> 
>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"



More information about the freebsd-hackers mailing list