unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] www: Atom stream respects timezone
@ 2017-07-13 22:48 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2017-07-13 22:48 UTC (permalink / raw)
  To: meta

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-07-13 22:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-13 22:48 [PATCH] www: Atom stream respects timezone Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).