[lug] changing timezone of a running process
D. Stimits
stimits at comcast.net
Mon Nov 3 20:48:20 MST 2003
Scott Herod wrote:
> This one should be relatively simple. How do I inform a running process
> that the timezone has changed. For example compile the code below then
> while it's running use timeconfig as root to set the timezone to
> something
> else.
>
> Thanks,
>
> Scott
>
> #include
> #include
> #include
> #include
>
> int main()
> {
> struct timeval tv;
> struct tm time;
>
> while ( true )
> {
> sleep ( 2 );
> tzset(); // Does this reset?
> gettimeofday( &tv, NULL );
> localtime_r( &tv.tv_sec, &time );
> std::cerr << "Offset " << time.tm_gmtoff << std::endl;
> }
> }
>
I think the usual way would be to have it intercept a kill -HUP like a
daemon, and then have it run again anything configurable. Or are you
talking about having the program self-detect?
D. Stimits, stimits AT comcast DOT net
More information about the LUG
mailing list