The attached patch fixes swaks for daylight savings time. -> Date: Sun, 04 Oct 2020 10:24:09 +1000
Above is from the output of swaks in Debian/Buster showing a wrong timezone for Australian Eastern time (Melbourne or Sydney if you want to test). Below is from the output of the patched version. -> Subject: test Sun, 04 Oct 2020 10:24:09 +1100 -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/
Index: swaks-20181104.0/swaks =================================================================== --- swaks-20181104.0.orig/swaks +++ swaks-20181104.0/swaks @@ -3170,9 +3170,16 @@ sub get_date_string { @l = gmtime($et); } else { my @g = gmtime($et); - $o = (timelocal(@l) - timelocal(@g)) / 60; - # Adjust to hours and minutes and not hours and hour-hundreths - # See debian bug 646084 + my $hour_diff; + # if the year is different then we are 1 day off + if($l[5] != $g[5]) { + $hour_diff = ($l[5] - $g[5])*24 + $l[2] - $g[2]; + } else { + $hour_diff = ($l[7] - $g[7])*24 + $l[2] - $g[2]; + } + my $min_diff = $l[1] - $g[1]; + # NB min_diff may be negative for timezone that is not an integer number of hours + $o = $hour_diff * 60 + $min_diff; $o = int($o / 60)*100 + ($o%60)*($o > 0 ? 1 : -1); } $G::date_string = sprintf("%s, %02d %s %d %02d:%02d:%02d %+05d",