summaryrefslogtreecommitdiff
path: root/lib/Travel/Status
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-01-23 14:40:04 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-01-23 14:40:04 +0100
commit8f6b0fc0931752acedee232f327b93ba45632062 (patch)
tree8305032bc05545b41517d49b364e319ac6eb61ea /lib/Travel/Status
parent9370341ffbfa7cb1eae628ee4ea69acd38dd0e73 (diff)
Result: Fix countdown_sec
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r--lib/Travel/Status/DE/URA/Result.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Travel/Status/DE/URA/Result.pm b/lib/Travel/Status/DE/URA/Result.pm
index e8cb1e8..3266d62 100644
--- a/lib/Travel/Status/DE/URA/Result.pm
+++ b/lib/Travel/Status/DE/URA/Result.pm
@@ -6,6 +6,8 @@ use 5.010;
use parent 'Class::Accessor';
+use DateTime::Format::Duration;
+
our $VERSION = '0.02';
Travel::Status::DE::URA::Result->mk_ro_accessors(
@@ -30,10 +32,10 @@ sub countdown {
sub countdown_sec {
my ($self) = @_;
+ my $secpattern = DateTime::Format::Duration->new( pattern => '%s' );
- $self->{countdown_sec}
- //= $self->datetime->subtract_datetime( $self->{dt_now} )
- ->in_units('seconds');
+ $self->{countdown_sec} //= $secpattern->format_duration(
+ $self->datetime->subtract_datetime( $self->{dt_now} ) );
return $self->{countdown_sec};
}