about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-11-25 05:24:54 +0000
committerEric Wong <e@80x24.org>2019-11-27 01:49:52 +0000
commitd462440b512629fd8ef444ce105477fcab2ae6b1 (patch)
tree7261332caf37402648aa2b87b88c349f2d7a1a48 /lib
parent754647b28663aae0e07b7a5307bcf8ecf91b1795 (diff)
downloadpublic-inbox-d462440b512629fd8ef444ce105477fcab2ae6b1.tar.gz
I'm not sure if TZ minute offsets aside from '00' or '30' exist,
but lets just deal with them properly when negative.  Examples
taken from various inboxes on lore.kernel.org.  These are mostly
message from spammers, but some are legitimate messages.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/MsgTime.pm4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/PublicInbox/MsgTime.pm b/lib/PublicInbox/MsgTime.pm
index 58e11d72..7dec48ce 100644
--- a/lib/PublicInbox/MsgTime.pm
+++ b/lib/PublicInbox/MsgTime.pm
@@ -23,6 +23,10 @@ sub str2date_zone ($) {
         my $sign = ($off < 0) ? '-' : '+';
         my $hour = abs(int($off / 3600));
         my $min  = ($off / 60) % 60;
+
+        # deal with weird offsets like '-0420' properly
+        $min = 60 - $min if ($min && $off < 0);
+
         my $zone = sprintf('%s%02d%02d', $sign, $hour, $min);
 
         # "-1200" is the furthest westermost zone offset,