http://qs321.pair.com?node_id=137958


in reply to Time Zones and Users

Try this:
perl -e 'print scalar localtime; $ENV{TZ}="PST"; print scalar localtim +e;'
Assuming you aren't in PST. and then you might just local the TZ within a block when you do the calculations etc.

PD> Corollary, let the OS and perl internal magic do as much work for you as it can.

--
perl -pe "s/\b;([st])/'\1/mg"

Replies are listed 'Best First'.
Re: Re: Time Zones and Users
by Torgo (Beadle) on Jan 11, 2002 at 22:27 UTC
    Hmmm. That's a good method, but it doesn't seem to work for Windows servers. Yeah, a crime against nature, but it's a requirement, and it's making this simple issue into a total beast.

    Thor, your idea of just setting a +/- X hours is nice, but doesn't take into account Daylight Savings Time. A lot of the world and some parts of America (Arizona, east Indiana) don't deal with it at all. If you do DST in your area, Check the current time on this site. If you set your options when our clocks were forward, it'll be off by one hour. That's fine for a realtime site like this, but no good for a scheduling app.

    --
    I write the code while the master is away!
      Ummm, I never said anything about +/- X hours...

      --
      perl -pe "s/\b;([st])/'\1/mg"