From: Eric Wong Date: Thu, 13 Jul 2017 22:47:29 +0000 (+0000) Subject: www: Atom stream respects timezone X-Git-Tag: v1.0.0~25 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=2a5b77c0cdd9bb1f726fd05b01d3095b029367ac www: Atom stream respects timezone Oops, we must not discard the timezone when parsing dates for the Atom stream. --- diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm index 5a10034b..b9c7468f 100644 --- a/lib/PublicInbox/WwwAtomStream.pm +++ b/lib/PublicInbox/WwwAtomStream.pm @@ -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');