]> Sergey Matveev's repositories - public-inbox.git/commitdiff
www: Atom stream respects timezone
authorEric Wong <e@80x24.org>
Thu, 13 Jul 2017 22:47:29 +0000 (22:47 +0000)
committerEric Wong <e@80x24.org>
Thu, 13 Jul 2017 22:47:29 +0000 (22:47 +0000)
Oops, we must not discard the timezone when parsing dates
for the Atom stream.

lib/PublicInbox/WwwAtomStream.pm

index 5a10034ba8ecfb33eb90f5210b43af648998fd97..b9c7468f18920d05025979c5dad6f1e547fddc21 100644 (file)
@@ -7,7 +7,7 @@ use strict;
 use warnings;
 
 use POSIX qw(strftime);
-use Date::Parse qw(strptime);
+use Date::Parse qw(str2time);
 use Digest::SHA qw(sha1_hex);
 use PublicInbox::Address;
 use PublicInbox::Hval qw(ascii_html);
@@ -109,8 +109,8 @@ sub feed_entry {
        }
        my $href = $base . mid_escape($mid) . '/';
        my $date = $hdr->header('Date');
-       my @t = eval { strptime($date) } if defined $date;
-       @t = gmtime(time) unless scalar @t;
+       my $t = eval { str2time($date) } if defined $date;
+       my @t = gmtime(defined $t ? $t : time);
        my $updated = feed_updated(@t);
 
        my $title = $hdr->header('Subject');