Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

replace DateTime with Time::Piece

  • Loading branch information...
commit 05d74015a72df657457b7c3c7ba088cf69a5a5dc 1 parent c2efbcd
@miyagawa authored
Showing with 5 additions and 7 deletions.
  1. +1 −2  Makefile.PL
  2. +4 −5 lib/RILFeed.pm
View
3  Makefile.PL
@@ -7,8 +7,7 @@ WriteMakefile(
'URI' => 0,
'XML::RSS' => 0,
'App::Cache' => 0,
- 'DateTime' => 0,
- 'DateTime::Format::Mail' => 0,
+ 'Time::Piece' => 0,
'WebService::Simple' => 0,
'JSON' => 2,
},
View
9 lib/RILFeed.pm
@@ -4,13 +4,11 @@ use LWP::Simple;
use URI;
use XML::RSS;
use App::Cache;
-use DateTime;
-use DateTime::Format::Mail;
use Encode;
use WebService::Simple;
+use Time::Piece ();
my $cache = App::Cache->new({ ttl => 7 * 24 * 60 * 60 });
-my $format = DateTime::Format::Mail->new;
my $apikey = $ENV{RIL_APIKEY};
@@ -76,14 +74,15 @@ sub serve_rss {
$html =~ s/&#(\d+);/chr($1)/eg;
$html =~ s!</\w+$!!; # RIL API bug
- my $dt = DateTime->from_epoch(epoch => $item->{time_added});
+ my $time = Time::Piece::gmtime($item->{time_added})->strftime;
+ $time =~ s/UTC/-0000/;
$feed->add_item(
title => $item->{title},
link => $item->{url},
permaLink => $item->{url},
content => { encoded => $html },
- pubDate => $format->format_datetime($dt),
+ pubDate => $time,
);
}
Please sign in to comment.
Something went wrong with that request. Please try again.