Jenda Krynicky wrote:
>
> #time diference to GMT - Windows will not set $ENV{'TZ'}, if you know a better way
>...
> my $GMTdiff;
> {
> my $time = time();
> my @local = (localtime($time))[2,1,3,4,5]; # hour, minute, mday, month,
>year; I don't mind year is 1900 based and month 0-11
> my @gm = (gmtime($time))[2,1,3,4,5];
> my $diffdate = ($gm[4]*512*32 + $gm[3]*32 + $gm[2]) <=> ($local[4]*512*32 +
>$local[3]*32 + $local[2]); # I know there are 12 months and 365-366 days. Any bigger
>numbers work fine as well ;-)
> if ($diffdate > 0) {$gm[0]+=24}
> elsif ($diffdate < 0) {$local[0]+=24}
> my $hourdiff = $gm[0]-$local[0];
> my $mindiff;
> if (abs($gm[1]-$local[1])<5) {
> $mindiff = 0
> } elsif (abs($gm[1]-$local[1]-30) <5) {
> $mindiff = 30
> } elsif (abs($gm[1]-$local[1]-60) <5) {
> $mindiff = 0;
> $hourdiff ++;
> }
> $GMTdiff = ($hourdiff < 0 ? '+' : '-') . sprintf "%02d%02d", abs($hourdiff),
>$mindiff;
> }
> my $date = localtime();
> $date =~ s/^(\w+)\s+(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+(\d+)$/$1, $3 $2 $5 $4/;
> $smtp->datasend("Date: $date $GMTdiff\n";
Or, you could do it the "correct" way. :-)
use POSIX 'strftime';
my $date = strftime '%a, %d %b %Y %H:%M:%S %z', localtime;
$smtp->datasend( "Date: $date\n" );
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]