Time in zone EST5EDT seems to be 11:04:43 2025-04-19
callfirst = y
#!/usr/bin/perl -Tw use CGI; use POSIX; my $cgi = new CGI; my @time; my $line; print($cgi->header, "\n"); if(lc($cgi->param("callfirst")) =~ m/^y/){ # callfirst=y # Duplicate the bug- call localtime() # BEFORE the TZ environment variable # is tweaked. Subsequent calls will # not respect TZ. This used to work # properly. # The effect is the same whether # localtime is explicitly called with # the output of time() or not. @time = localtime(); } $ENV{'TZ'} = 'EST5EDT'; # $ENV{'TZ'} = 'CST6CDT'; @time = localtime(); print "Time in zone " . $ENV{TZ} . " seems to be "; printf("%02i:%02i:%02i %4i-%02i-%02i<BR>\n", $time[2], $time[1], $time[0], $time[5]+1900, $time[4]+1, $time[3]); # Show what parameters we got. print("<BR>\n"); if($cgi->param()){ foreach($cgi->param()){ print($_, " = ", $cgi->param($_), "<BR>\n"); } } print("<BR>\n"); # Make the source visible print("<PRE>\n"); sysopen(SRC, "/home/otto/public_html/timetest.cgi", O_RDONLY) or do{ print("Cannot open file: $!\n"); print("</PRE>\n"); exit(0); }; while($line = <SRC>){ $line =~ s/&/&/g; $line =~ s/</</g; $line =~ s/>/>/g; print($line); } close(SRC); print("</PRE>\n"); exit(0);