Subject: Re: syntax ideas solicited
To: Andrew Brown <>
From: Simon Burge <>
List: tech-userlevel
Date: 12/27/2001 14:01:47
Andrew Brown wrote:

> >My laptop has been up since January, when I brought it back into the
> >country, and changed /etc/localtime back to its usual setting. OK, I
> >arguably should have restarted cron after doing that, but it would have
> >been nice of cron to notice at some point in the last 11 and a half months
> >that it's now running in a different timezone to where it thought it was
> >when it started. :)
> it seems to me, from perusing the cron code and libc/time/localtime.c
> a little, that if cron did this:
> 	struct tm *tm;
> 	...
> 	putenv("TZ=UTC");
> 	localtime(&TargetTime);
> 	unsetenv("TZ");
> 	tm = localtime(&TargetTime);
> instead of
> 	struct tm *tm = localtime(&TargetTime);
> at the top of cron_tick(), you might be able to get what you want.
> unless, of course, you've run cron with TZ already set to something.
> then again, changing the above to deal with that ought to be
> relatively trivial.

Note that repeated calls to {put,set}env() can result in a memory leak
because setenv() calls malloc() and realloc()...

Simon Burge                            <>
NetBSD CDs, Support and Service: