Perl cgi time issue

software development


This is a little hard to explain but let me try. I have a perl cgi that displays the time in the Central Time Zone. I just noticed that this is now displaying Arizona time. I believe this began after the recent OS upgrades but I cannot be certain.

I’ve isolated the code to the problem and have noticed something funny.

Here is some code that shows what I am seeing:


use Time::Local;
use Time::localtime;

$tm = localtime();
$hour= $tm->hour;
$min= $tm->min;

print"Content-type: text/html\n\n";
print “”;
print “time = $hour:$min\n”;
print “”;

The funny thing is, if I run this from the command line, it displays the time correctly in CST6CDT. If I run it from my website it displays the wrong time.

The second thing I’ve found, is if I comment out Time::Local, the time displays correctly from the command line and from the website. The piece of code above does not need Time::Local but is needed on my website.

I’ve emailed support and they are stumped and suggested I see if anyone here has had similar experiences.

Any ideas?



I found a work around -

Added the following to .htaccess