Bug#566013: [swaks] sends mails from a weird timezone

Gunnar Wolf gwolf at gwolf.org
Wed Jan 27 17:40:11 UTC 2010


Gunnar Wolf dijo [Wed, Jan 27, 2010 at 10:24:08AM -0600]:
> --- /usr/share/perl/5.10.1/Time/Local.pm	2009-11-21 13:30:05.000000000 -0600
> +++ /tmp/Local.pm				2010-01-27 10:21:17.000000000 -0600
> @@ -177,7 +177,11 @@
>      my ( $s, $m, $h ) = localtime($loc_t);
>      $loc_t -= $dst_off if $s != $_[0] || $m != $_[1] || $h != $_[2];
>  
> -    return $loc_t;
> +    # Comparing two very-slightly-off readings of the clock yields a
> +    # difference of -0.027777 seconds. Timezones are integers, and
> +    # represent the number of seconds; round (don't truncate) the
> +    # result as values ending with '99' are not valid.
> +    return int($loc_t + 0.5); 
>  }
>  
>  sub timelocal_nocheck {

Please note that, talking this over with the pkg-perl group, it
becomes obvious that this fix (if it is to be favored) should be
applied some lines earlier, as there are several point where values
are returned before this. Possibly:

--- /usr/share/perl/5.10.1/Time/Local.pm	2009-11-21 13:30:05.000000000 -0600
+++ /tmp/Local.pm				2010-01-27 11:39:21.000000000 -0600
@@ -146,8 +146,8 @@
 }
 
 sub timelocal {
-    my $ref_t = &timegm;
-    my $loc_for_ref_t = _timegm( localtime($ref_t) );
+    my $ref_t = int(&timegm + 0.5);
+    my $loc_for_ref_t = int(_timegm( localtime($ref_t) ) + 0.5);
 
     my $zone_off = $loc_for_ref_t - $ref_t
         or return $loc_for_ref_t;


Still, this will only hide the problem, not really fix it.

-- 
Gunnar Wolf • gwolf at gwolf.org • (+52-55)5623-0154 / 1451-2244






More information about the Perl-maintainers mailing list