Perl question

Kevin Buettner plug-devel@lists.PLUG.phoenix.az.us
Mon May 21 20:56:01 2001


On May 23,  5:41am, Carl Parrish wrote:

> Okay apparently I still didn't give enough information. I don't want the 
> actually system time on these machines to change. They all have 
> different TZ settings (I just learned what that is thank you very much). 
> This is what I want to do. Regardless of what the local time is I want 
> my application on all of these machines to read EST. So is there some 
> way for to set the TZ (or some other variable ) to EST for the 
> *application* while leaving everything else on the box to the current 
> local time?

Yes.  Please note the answer in Victor's response...

Here:
> > So to get "localtime" to display the time for a specific time
> > zone, just set the TZ value of your process to the time zone in
> > question, then use "localtime".  It doesn't know or care what time
> > zone you're really in, or what server you set your time from.

And here:
> > Note again what Kevin said:  You can set $ENV{ TZ } to "EST" or
> > "US/Eastern".  I don't know what US/Eastern is, but EST does not
> > adjust for daylight savings.

In other words, just put

    $ENV{TZ} = "EST";

near the beginning of your perl script.

BTW, US/Eastern does adjust for daylight savings time on my machines.
I think the only people who are on EST at the moment are folks living
in certain parts of Indiana.  See

    http://www.iupui.edu/it/ibrc/Misc/indiana_time.html

for more info.  (I.e, I really doubt you want to use EST unless the
service you're providing is Indiana-centric.)

Kevin