Time zone help

L

lonewolfcsu

I'm running a perl script on a server our company has set up to run on
GMT time. During the execution of the script I need to make reference
to the $isdst flag set by the localtime funtion. The problem is that
GMT doesn't observe daylight savings, and so the flag is always set to
0. I can do nothing about the server's timezone setting.

I obviously know about localtime() and gmtime(). Are there any other
time functions I may be able to use to find out if a date falls under
DST or not?
 
P

Paul Lalli

I'm running a perl script on a server our company has set up to run on
GMT time. During the execution of the script I need to make reference
to the $isdst flag set by the localtime funtion. The problem is that
GMT doesn't observe daylight savings, and so the flag is always set to
0. I can do nothing about the server's timezone setting.

I obviously know about localtime() and gmtime(). Are there any other
time functions I may be able to use to find out if a date falls under
DST or not?

Why can't you just have your script modify its environment to put
itself in a different timezone?

$ echo $TZ
US/Eastern
$ perl -we'
$here = (localtime)[8];
$ENV{TZ} = q{GMT};
$there = (localtime)[8];
print "Here: $here, There: $there\n";
'
Here: 1, There: 0

Paul Lalli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top