Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Revert "replace DateTime with Time::Piece"

This reverts commit 05d7401.
  • Loading branch information...
commit 0094b99e6298c9feff1e15e42b013488acb1d99c 1 parent 0d4e094
Tatsuhiko Miyagawa authored

Showing 2 changed files with 7 additions and 5 deletions. Show diff stats Hide diff stats

  1. +2 1  Makefile.PL
  2. +5 4 lib/RILFeed.pm
3  Makefile.PL
@@ -7,7 +7,8 @@ WriteMakefile(
7 7 'URI' => 0,
8 8 'XML::RSS' => 0,
9 9 'App::Cache' => 0,
10   - 'Time::Piece' => 0,
  10 + 'DateTime' => 0,
  11 + 'DateTime::Format::Mail' => 0,
11 12 'WebService::Simple' => 0,
12 13 'JSON' => 2,
13 14 },
9 lib/RILFeed.pm
@@ -4,11 +4,13 @@ use LWP::Simple;
4 4 use URI;
5 5 use XML::RSS;
6 6 use App::Cache;
  7 +use DateTime;
  8 +use DateTime::Format::Mail;
7 9 use Encode;
8 10 use WebService::Simple;
9   -use Time::Piece ();
10 11
11 12 my $cache = App::Cache->new({ ttl => 7 * 24 * 60 * 60 });
  13 +my $format = DateTime::Format::Mail->new;
12 14
13 15 my $apikey = $ENV{RIL_APIKEY};
14 16
@@ -75,15 +77,14 @@ sub serve_rss {
75 77 $html =~ s/&#(\d+);/chr($1)/eg;
76 78 $html =~ s!</\w+$!!; # RIL API bug
77 79
78   - my $time = Time::Piece::gmtime($item->{time_added})->strftime;
79   - $time =~ s/UTC/-0000/;
  80 + my $dt = DateTime->from_epoch(epoch => $item->{time_added});
80 81
81 82 $feed->add_item(
82 83 title => $item->{title},
83 84 link => $item->{url},
84 85 permaLink => $item->{url},
85 86 content => { encoded => $html },
86   - pubDate => $time,
  87 + pubDate => $format->format_datetime($dt),
87 88 );
88 89 }
89 90

0 comments on commit 0094b99

Please sign in to comment.
Something went wrong with that request. Please try again.