From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 02A3620365 for ; Thu, 13 Jul 2017 22:48:07 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] www: Atom stream respects timezone Date: Thu, 13 Jul 2017 22:48:06 +0000 Message-Id: <20170713224806.21752-1-e@80x24.org> List-Id: Oops, we must not discard the timezone when parsing dates for the Atom stream. --- lib/PublicInbox/WwwAtomStream.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm index 5a10034..b9c7468 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'); -- EW