[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: time zone on linux



On Tue, Nov 20, 2001 at 06:57:11PM +0530, kilaru wrote:
> Now my doubt is how will I know if root changes timezone while my daemon is 
> running?( I do not want to kill and restart the daemon).
> 
> If any body knows how to do it please tell me.

If your Linux box was setup properly, the system time will actually be
in GMT, and it will just convert for display based upon /etc/localtime.
You shouldn't have to update the timezone manually in that case (at
least, all of my Debian boxen automatically change between PDT and PST
just fine).  What you should do in your daemon is use localtime()
internally (number of seconds since 1970 in GMT), and then use asctime()
or mktime() on display only to translate into the local timezone.

If the hardware clock is not set to GMT, you're working with a broken
setup, and should fix that first.

M



Reply to: