Steven D. Majewski (
Wed, 15 Jun 1994 18:32:39 -0400

And, while we're on the subject of www/cgi scripts:

I posted a note to comp.unix.aix about my problems with tzset(),
which just happened to be in a python cgi script. Environment
variable TZ is not set in the environment in which the script
is executing, so everything comes out Coordinated Universal Time
rather than localtime.

I suppose I could just run python indirectly from a sh script
that sets that environment variable first. Or I could just
hardwire 'time.ctime( time.time() - 14400.0 )' ... until
I have to change it to -180000.0 [ my current kludge around
this problem! ] but I'm not fond of either solution.

I would be tempted to rewrite timemodule so that it could be
reinitialized ( which may not be necessary, as my man pages
say the tzset is implicitly called by ctime and localtime )
but is there any other input to tzset() that the TZ environment
variable ? Or is there any way to set an environment variable
in the current process other that thru a shell ?

( I guess I could have a python script execve itself with TZ
added to the environment, but is there any more direct method? )

- Steve Majewski (804-982-0831) <sdm7g@Virginia.EDU>
- UVA Department of Molecular Physiology and Biological Physics

In article <CrEz5F.FMo@murdoch.acc.Virginia.EDU>, I
( Steven D. Majewski <> )
wrote in comp.unix.aix:
>The man page ( for tzset ) says:
>| If the TZ environment variable is defined, then its value over-
>| rides the default time zone, which is the U.S. Eastern time
>| zone. The environment facility contains the format of the time
>| zone information specified by TZ. TZ is usually set when the sys-
>| tem is started with the value that is defined in either the
>| /etc/environment or /etc/profile files. However, it can also be
>| set by the user as a regular environment variable for performing
>| alternate time zone conversions.
>However, this does not appear to be true for my machines
>( One running AIX 3.2.4 and the other 3.2.0 )
>When environment variable TZ is _unset_, timezone = 0 and
>tzname = { 'CUT', '' } after tzset() : Coordinated Universal Time -
> *NOT* U.S. Eastern time zone!
> Does anyone else observer this bug ?
>I ran into this while testing a server that is not run from a login
>shell environment ( where TZ always appears to be set properly )
>But even though TZ is set in my /etc/environment file, it still
>appears to not be set. ( I thought that was the whole point of
>/etc/environment - that it would be set in the environment even
>without an interactive login shell. Do I misunderstand this ? )