Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Oct 2007 10:57:12 -0400
From:      Chuck Swiger <cswiger@mac.com>
To:        Andrew McNaughton <andrew@scoop.co.nz>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How do I catch timezone update and perform needed actions?
Message-ID:  <4703ADC8.4000000@mac.com>
In-Reply-To: <4702FBA7.6040203@scoop.co.nz>
References:  <4702FBA7.6040203@scoop.co.nz>

next in thread | previous in thread | raw e-mail | index | archive | help
Andrew McNaughton wrote:
> OK, so daylight savings just rolled over again.  Applications which are
> already running apparently do not pick up the time zone change.

Nope, that doesn't just happen.  See "man tzset" and maybe the misc/zoneinfo 
port.  And ntpd.

> In my installation apache is not regularly restarted, so it's 4 days later and
> I just noticed that apache has been putting the wrong time stamps on
> everything, and a script that regularly processes the last 10 minutes of
> log data based on time stamps on log lines has been coming up empty for
> days as a result.
> 
> What I need is a way to stop this happening again in years to come.

If the apps are properly written, they won't care much about TZ changes 
anyway.  About the only sane programming practice is for applications to 
always store timestamps in a format independent of TZ (ie, UTC/GMT, time_t, 
etc), and always be willing to redisplay that data in the user's current 
timezone (which they can change at will).

> I thought about submitting a pr asking for some system change such that
> a user configurable script gets run whenever the time zone changes. 
> Perhaps such a mechanism exists already though?
> 
> Any pointers?  Should this be submitted as a pr?

You might find that setting the system TZ to GMT systemwide and then setting 
the local TZ as an override in their .login or only for any users or programs 
which want to know the local TZ and are smart enough to deal with DST changes.

Otherwise, the best choice is to restart everything after a timezone change.

-- 
-Chuck




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4703ADC8.4000000>